diff options
author | Matti Picus <matti.picus@gmail.com> | 2018-11-12 09:55:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-12 09:55:02 -0800 |
commit | e34f5bb4e3aad2bb35fb6d9e3a5c1bfc85eb97eb (patch) | |
tree | d73f8e03bdb850c75a98dc8841fe1d2a04d91925 /numpy/core/include | |
parent | 685aef76de436bf2b42a74a52a22041d08a79007 (diff) | |
parent | e044ae30ad80250ad9add0ff6e56ab972e1ec3d5 (diff) | |
download | numpy-e34f5bb4e3aad2bb35fb6d9e3a5c1bfc85eb97eb.tar.gz |
Merge pull request #8955 from eric-wieser/obj-identity
ENH: Allow ufunc.identity to be any python object
Diffstat (limited to 'numpy/core/include')
-rw-r--r-- | numpy/core/include/numpy/ufuncobject.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/core/include/numpy/ufuncobject.h b/numpy/core/include/numpy/ufuncobject.h index 85f8a6c08..90d837a9b 100644 --- a/numpy/core/include/numpy/ufuncobject.h +++ b/numpy/core/include/numpy/ufuncobject.h @@ -223,7 +223,8 @@ typedef struct _tagPyUFuncObject { */ npy_uint32 *core_dim_flags; - + /* Identity for reduction, when identity == PyUFunc_IdentityValue */ + PyObject *identity_value; } PyUFuncObject; @@ -299,6 +300,12 @@ typedef struct _tagPyUFuncObject { * This case allows reduction with multiple axes at once. */ #define PyUFunc_ReorderableNone -2 +/* + * UFunc unit is in identity_value, and the order of operations can be reordered + * This case allows reduction with multiple axes at once. + */ +#define PyUFunc_IdentityValue -3 + #define UFUNC_REDUCE 0 #define UFUNC_ACCUMULATE 1 |