summaryrefslogtreecommitdiff
path: root/numpy/core/include
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-04-17 23:41:36 +0100
committerEric Wieser <wieser.eric@gmail.com>2018-11-12 09:14:50 -0800
commitd3b2036949255e48ecbcfcc70ed2ea95c755cf2a (patch)
tree703569f42f06539eb1c7a95c841d5a271079ea5a /numpy/core/include
parent97df928718a46b869d0d6675ffd6e8c539f32773 (diff)
downloadnumpy-d3b2036949255e48ecbcfcc70ed2ea95c755cf2a.tar.gz
ENH: Allow ufunc.identity to be any python object
Diffstat (limited to 'numpy/core/include')
-rw-r--r--numpy/core/include/numpy/ufuncobject.h9
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