diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-10-09 08:45:20 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-10-09 08:45:20 +0000 |
commit | ecbabb3ac7764c09ae8f6f8aff691b36f40b6870 (patch) | |
tree | acf3688a6a62ada193df36665cf67190496412e4 | |
parent | 9c9f739d4589ed7ad5469bda7269e79e90d843cb (diff) | |
download | numpy-ecbabb3ac7764c09ae8f6f8aff691b36f40b6870.tar.gz |
Speed up concatenate and choose when sequence is an array.
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 3d8da5f80..d290df270 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -1751,6 +1751,21 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) return (void*)PyErr_NoMemory(); } + if (PyArray_Check(op)) { + for (i=0; i<n; i++) { + mps[i] = array_big_item((PyArrayObject *)op, i); + } + if (!PyArray_ISCARRAY(op)) { + for (i=0; i<n; i++) { + PyObject *obj; + obj = PyArray_NewCopy(mps[i], NPY_CORDER); + Py_DECREF(mps[i]); + mps[i] = (PyArrayObject *)obj; + } + } + return mps; + } + for(i=0; i<n; i++) { otmp = PySequence_GetItem(op, i); if (!PyArray_CheckAnyScalar(otmp)) { |