summaryrefslogtreecommitdiff
path: root/scipy/base/src
diff options
context:
space:
mode:
Diffstat (limited to 'scipy/base/src')
-rw-r--r--scipy/base/src/arraymethods.c2
-rw-r--r--scipy/base/src/scalartypes.inc.src12
-rw-r--r--scipy/base/src/umathmodule.c.src24
3 files changed, 29 insertions, 9 deletions
diff --git a/scipy/base/src/arraymethods.c b/scipy/base/src/arraymethods.c
index 6c2ff5ab8..70a0cc795 100644
--- a/scipy/base/src/arraymethods.c
+++ b/scipy/base/src/arraymethods.c
@@ -49,7 +49,7 @@ array_putmask(PyArrayObject *self, PyObject *args, PyObject *kwds)
return PyArray_PutMask(self, mask, values);
}
-static char doc_reshape[] = "a.reshape((d1, d2, ..., dn)). Change the shape of a to be an n-dimensional array with dimensions given by d1...dn. Note: the size specified for the new array must be exactly equal to the size of the old one or an error will occur.";
+static char doc_reshape[] = "a.reshape(d1, d2, ..., dn). Change the shape of a to be an n-dimensional array with dimensions given by d1...dn. Note: the size specified for the new array must be exactly equal to the size of the old one or an error will occur.";
static PyObject *
array_reshape(PyArrayObject *self, PyObject *args)
diff --git a/scipy/base/src/scalartypes.inc.src b/scipy/base/src/scalartypes.inc.src
index 18614ab52..45cb9d120 100644
--- a/scipy/base/src/scalartypes.inc.src
+++ b/scipy/base/src/scalartypes.inc.src
@@ -164,7 +164,7 @@ gentype_generic_method(PyObject *self, PyObject *args, PyObject *kwds,
ret = PyObject_Call(meth, args, kwds);
Py_DECREF(meth);
Py_DECREF(arr);
- return ret;
+ return PyArray_Return((PyArrayObject *)ret);
}
/**begin repeat
@@ -398,8 +398,13 @@ format_longdouble(char *buf, size_t buflen, longdouble val, int precision)
}
}
-#define PREC_REPR 19
-#define PREC_STR 17
+#if SIZEOF_LONGDOUBLE == SIZEOF_DOUBLE
+#define PREC_REPR 15
+#define PREC_STR 15
+#else
+#define PREC_REPR 21
+#define PREC_STR 21
+#endif
static PyObject *
longdoubletype_repr(PyObject *self)
@@ -542,7 +547,6 @@ gentype_shape_get(PyObject *self)
return PyTuple_New(0);
}
-
static PyObject *
gentype_data_get(PyObject *self)
{
diff --git a/scipy/base/src/umathmodule.c.src b/scipy/base/src/umathmodule.c.src
index 851909dbc..396b3e421 100644
--- a/scipy/base/src/umathmodule.c.src
+++ b/scipy/base/src/umathmodule.c.src
@@ -1182,21 +1182,33 @@ static void
/**begin repeat
- #TYPE=BOOL, BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG#
- #typ=bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong#
+ #TYPE=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG#
+ #typ=byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong#
*/
static void
@TYPE@_invert(char **args, intp *dimensions, intp *steps, void *func)
{
register intp i;
- intp is1=steps[0], os=steps[2];
+ intp is1=steps[0], os=steps[1], n=dimensions[0];
char *i1=args[0], *op=args[1];
- for(i=0; i<*dimensions; i++, i1+=is1, op+=os) {
+ for(i=0; i<n; i++, i1+=is1, op+=os) {
*((@typ@ *)op) = ~ *((@typ@*)i1);
}
}
/**end repeat**/
+static void
+BOOL_invert(char **args, intp *dimensions, intp *steps, void *func)
+{
+ register intp i;
+ intp is1=steps[0], os=steps[1], n=dimensions[0];
+ char *i1=args[0], *op=args[1];
+ for(i=0; i<n; i++, i1+=is1, op+=os) {
+ *((bool *)op) = (*((bool *)i1) ? false : true);
+ }
+}
+
+
/**begin repeat
#TYPE=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE#
@@ -1542,6 +1554,10 @@ DL_EXPORT(void) initumath(void) {
PyDict_SetItemString(d, "UFUNC_BUFSIZE_NAME",
s=PyString_FromString(UFUNC_BUFSIZE_NAME));
Py_DECREF(s);
+ PyDict_SetItemString(d, "UFUNC_BUFSIZE_DEFAULT",
+ s=PyInt_FromLong(PyArray_BUFSIZE));
+ Py_DECREF(s);
+
pinf = pinf_init();
PyDict_SetItemString(d, "PINF", s = PyFloat_FromDouble(pinf));