summaryrefslogtreecommitdiff
path: root/numpy/core/src/arraymethods.c
diff options
context:
space:
mode:
authorsasha <sasha@localhost>2006-02-24 00:37:16 +0000
committersasha <sasha@localhost>2006-02-24 00:37:16 +0000
commitadc21734b3b1d5bfdf027c4966fba3bbece12468 (patch)
tree14a6f94fb857ab199bd1b1e8707651cf9f820443 /numpy/core/src/arraymethods.c
parent9f395ae6f261a879ef9311a0c0b7f5b7eec97693 (diff)
downloadnumpy-adc21734b3b1d5bfdf027c4966fba3bbece12468.tar.gz
added rint ufunc and ndarray.round
Diffstat (limited to 'numpy/core/src/arraymethods.c')
-rw-r--r--numpy/core/src/arraymethods.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c
index fe87009e0..559617016 100644
--- a/numpy/core/src/arraymethods.c
+++ b/numpy/core/src/arraymethods.c
@@ -1451,6 +1451,20 @@ array_ravel(PyArrayObject *self, PyObject *args)
return PyArray_Ravel(self, fortran);
}
+static char doc_round[] = "a.round(decimals=0)";
+
+static PyObject *
+array_round(PyArrayObject *self, PyObject *args, PyObject *kwds)
+{
+ int decimals = 0;
+ static char *kwlist[] = {"decimals", NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist,
+ &decimals))
+ return NULL;
+
+ return _ARET(PyArray_Round(self, decimals));
+}
static char doc_setflags[] = "a.setflags(write=None, align=None, uic=None)";
@@ -1643,6 +1657,8 @@ static PyMethodDef array_methods[] = {
METH_VARARGS, doc_flatten},
{"ravel", (PyCFunction)array_ravel,
METH_VARARGS, doc_ravel},
+ {"round", (PyCFunction)array_round,
+ METH_VARARGS|METH_KEYWORDS, doc_round},
{"setflags", (PyCFunction)array_setflags,
METH_VARARGS|METH_KEYWORDS, doc_setflags},
{"newbyteorder", (PyCFunction)array_newbyteorder,