diff options
| author | Travis Oliphant <oliphant@enthought.com> | 2006-09-21 16:58:07 +0000 |
|---|---|---|
| committer | Travis Oliphant <oliphant@enthought.com> | 2006-09-21 16:58:07 +0000 |
| commit | 4c856fa57b5dfd387f83c308a8f3933dd5792012 (patch) | |
| tree | 78a3b0091b534e897364610079e9a78f0a94245e /numpy/core/src/umathmodule.c.src | |
| parent | b07ee45ae38c2102dbd373894fe5389348058870 (diff) | |
| download | numpy-4c856fa57b5dfd387f83c308a8f3933dd5792012.tar.gz | |
Add Object-type to maximum and minimum ufuncs.
Diffstat (limited to 'numpy/core/src/umathmodule.c.src')
| -rw-r--r-- | numpy/core/src/umathmodule.c.src | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src index ee3dca549..fa7cd678b 100644 --- a/numpy/core/src/umathmodule.c.src +++ b/numpy/core/src/umathmodule.c.src @@ -1207,7 +1207,6 @@ static void /**end repeat**/ - static PyObject * Py_reciprocal(PyObject *o) { @@ -1219,6 +1218,40 @@ Py_reciprocal(PyObject *o) return result; } +static PyObject * +_npy_ObjectMax(PyObject *i1, PyObject *i2) +{ + int cmp; + PyObject *res; + if (PyObject_Cmp(i1, i2, &cmp) < 0) return NULL; + + if (cmp >= 0) { + res = i1; + } + else { + res = i2; + } + Py_INCREF(res); + return res; +} + +static PyObject * +_npy_ObjectMin(PyObject *i1, PyObject *i2) +{ + int cmp; + PyObject *res; + if (PyObject_Cmp(i1, i2, &cmp) < 0) return NULL; + + if (cmp <= 0) { + res = i1; + } + else { + res = i2; + } + Py_INCREF(res); + return res; +} + /* ones_like is defined here because it's used for x**0 */ /**begin repeat |
