David,

I'm not sure that fix is completely correct. The out keyword is funny and
I'm not what the specs are supposed to be, but generally the output is cast
rather than an error raised. We need an official spec here because the
documentation of this feature is essentially random. Note that the shapes
don't really have to match, either.

In [1]: x = ones(5)

In [2]: out = ones(5, dtype=int8)

In [3]: cumsum(x, out=out)
Out[3]: array([1, 2, 3, 4, 5], dtype=int8)

In [4]: out = empty((5,1))

In [5]: cumsum(x, out=out)
Out[5]:
array([[ 1.],
       [ 2.],
       [ 3.],
       [ 4.],
       [ 5.]])

OTOH, out = empty((1,5)) doesn't work but doesn't raise an error. Confused?
Me too.

Chuck
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to