Skip to content

Commit

Permalink
Speed up concatenate and choose when sequence is an array.
Browse files Browse the repository at this point in the history
  • Loading branch information
teoliphant committed Oct 9, 2006
1 parent 9c9f739 commit ecbabb3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions numpy/core/src/multiarraymodule.c
Expand Up @@ -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)) {
Expand Down

0 comments on commit ecbabb3

Please sign in to comment.