[Matrix-SIG] A Patch to only convert rank-0 arrays if they match Python Objects
Travis Oliphant
Oliphant.Travis@mayo.edu
Tue, 7 Sep 1999 10:49:19 -0500 (CDT)
Following up on the compromise suggested by Konrad for conversion of
rank-0 arrays, I propose the following minor patch so that single
Aprecision rank-0 arrays do not get automatically converted to Python
scalars.
*** LLNLDistribution12beta.orig/Numerical/Src/arrayobject.c Mon Aug 9 13:36:24 1999
--- LLNLDistribution12beta/Numerical/Src/arrayobject.c Tue Sep 7 10:42:51 1999
***************
*** 443,449 ****
if (mp != NULL) Py_DECREF(mp);
return NULL;
}
! if (mp->nd == 0) {
op = array_item(mp, 0);
Py_DECREF(mp);
return op;
--- 443,449 ----
if (mp != NULL) Py_DECREF(mp);
return NULL;
}
! if (mp->nd == 0 && (mp->type_num==PyArray_LONG || mp->type_num==PyArray_DOUBLE || mp->type_num==PyArray_CDOUBLE || mp->type_num==PyArray_OBJECT) ) {
op = array_item(mp, 0);
Py_DECREF(mp);
return op;
-Travis