summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/include/numpy/arrayobject.h2
-rw-r--r--numpy/core/numeric.py10
-rw-r--r--numpy/core/src/arrayobject.c2
-rw-r--r--numpy/core/src/arraytypes.inc.src6
4 files changed, 10 insertions, 10 deletions
diff --git a/numpy/core/include/numpy/arrayobject.h b/numpy/core/include/numpy/arrayobject.h
index 0ded2eb26..ed76acb87 100644
--- a/numpy/core/include/numpy/arrayobject.h
+++ b/numpy/core/include/numpy/arrayobject.h
@@ -811,7 +811,7 @@ typedef int (PyArray_FillFunc)(void *, intp, void *);
typedef int (PyArray_SortFunc)(void *, intp, void *);
typedef int (PyArray_ArgSortFunc)(void *, intp *, intp, void *);
-typedef int (PyArray_FillWithScalarFunc)(void *, intp, intp, void *);
+typedef int (PyArray_FillWithScalarFunc)(void *, intp, void *, void *);
typedef struct {
intp *ptr;
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 1da30e68f..d4359a540 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -340,11 +340,11 @@ def ones(shape, dtype=int_, fortran=False):
"""ones(shape, dtype=int_) returns an array of the given
dimensions which is initialized to all ones.
"""
- # This appears to be slower...
- #a = empty(shape, dtype, fortran)
- #a.fill(1)
- a = zeros(shape, dtype, fortran)
- a+=1
+ a = empty(shape, dtype, fortran)
+ a.fill(1)
+ # Above is faster now after addition of fast loops.
+ #a = zeros(shape, dtype, fortran)
+ #a+=1
return a
def identity(n,dtype=int_):
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index cd83f31e1..fe53283a5 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -4112,7 +4112,7 @@ PyArray_FillWithScalar(PyArrayObject *arr, PyObject *obj)
arr->descr->f->fillwithscalar;
if (fillwithscalar && PyArray_ISALIGNED(arr)) {
copyswap(fromptr, NULL, swap, itemsize);
- fillwithscalar(toptr, size, itemsize, fromptr);
+ fillwithscalar(toptr, size, fromptr, arr);
}
else {
while (size--) {
diff --git a/numpy/core/src/arraytypes.inc.src b/numpy/core/src/arraytypes.inc.src
index 2c570b946..4bd24904a 100644
--- a/numpy/core/src/arraytypes.inc.src
+++ b/numpy/core/src/arraytypes.inc.src
@@ -1715,7 +1715,7 @@ static void
/* this requires buffer to be filled with objects or NULL */
static void
-OBJECT_fillwithscalar(PyObject **buffer, intp length, intp ignored, PyObject **value)
+OBJECT_fillwithscalar(PyObject **buffer, intp length, PyObject **value, void *ignored)
{
intp i;
PyObject *val = *value;
@@ -1730,7 +1730,7 @@ OBJECT_fillwithscalar(PyObject **buffer, intp length, intp ignored, PyObject **v
#typ=Bool,byte,ubyte#
*/
static void
-@NAME@_fillwithscalar(@typ@ *buffer, intp length, intp ignored, @typ@ *value)
+@NAME@_fillwithscalar(@typ@ *buffer, intp length, @typ@ *value, void *ignored)
{
memset(buffer, *value, length);
}
@@ -1741,7 +1741,7 @@ static void
#typ=short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,longdouble,cfloat,cdouble,clongdouble#
*/
static void
-@NAME@_fillwithscalar(@typ@ *buffer, intp length, intp ignored, @typ@ *value)
+@NAME@_fillwithscalar(@typ@ *buffer, intp length, @typ@ *value, void *ignored)
{
register intp i;
@typ@ val = *value;