Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-14 Thread Sebastian Walter
I've written a self-contained example that shows that numpy indeed tries to call the __float__ method. What is buggy is what happens if calling the __float__ method raises an Exception. Then numpy assumes (in this case wrongly) that the object should be casted to the neutral element. I'd guess

[Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Sebastian Walter
Hello, I have a question about the augmented assignment statements *=, +=, etc. Apparently, the casting of types is not working correctly. Is this known resp. intended behavior of numpy? (I'm using numpy.__version__ = '1.4.0.dev7039' on this machine but I remember a recent checkout of numpy

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Robert Kern
On Tue, Jan 12, 2010 at 12:05, Sebastian Walter sebastian.wal...@gmail.com wrote: Hello, I have a question about the augmented assignment statements *=, +=, etc. Apparently, the casting of types is not working correctly. Is this known resp. intended behavior of numpy? Augmented assignment

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread josef . pktd
On Tue, Jan 12, 2010 at 1:05 PM, Sebastian Walter sebastian.wal...@gmail.com wrote: Hello, I have a question about the augmented assignment statements *=, +=, etc. Apparently, the casting of types is not working correctly. Is this known resp. intended behavior of numpy? (I'm using

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Sebastian Walter
On Tue, Jan 12, 2010 at 7:09 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:05, Sebastian Walter sebastian.wal...@gmail.com wrote: Hello, I have a question about the augmented assignment statements *=, +=, etc. Apparently, the casting of types is not working

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Robert Kern
On Tue, Jan 12, 2010 at 12:31, Sebastian Walter sebastian.wal...@gmail.com wrote: On Tue, Jan 12, 2010 at 7:09 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:05, Sebastian Walter sebastian.wal...@gmail.com wrote: Hello, I have a question about the augmented assignment

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Sebastian Walter
On Tue, Jan 12, 2010 at 7:38 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:31, Sebastian Walter sebastian.wal...@gmail.com wrote: On Tue, Jan 12, 2010 at 7:09 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:05, Sebastian Walter

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Christopher Barker
Sebastian Walter wrote: However, this particular problem occurs when you try to automatically differentiate an algorithm by using an Algorithmic Differentiation (AD) tool. E.g. given a function x = numpy.ones(2) def f(x): a = numpy.ones(2) a *= x return numpy.sum(a) I don't know