Kilian Koepsell wrote:
> hi,
>> i came across the following strange behavior while multiplying a
> scipy array:
> a[:,2:] gives a column of zeros if a is an 2x2 array (that is correct)
> but if i multiply this column by zero, it affects the element a[2,0]
> which is probably a bug.
>> >>> from scipy import *
> >>> a = array([[1,2],[3,4]])
> >>> a
> array([[1, 2],
> [3, 4]])
> >>> a[:,2:]
> zeros((2, 0), 'l')
> >>> a[:,2:] *= 0
> >>> a
> array([[1, 2],
> [0, 4]])
>> i am using scipy 0.3.2 with python 2.4.2 and Mac OSX 10.4.5.
This is a bug in Numeric 24.x. This bug does not appear in current versions of
numpy, Numeric's replacement.
In [37]: import numpy
In [38]: import Numeric
In [39]: a = numpy.array([[1, 2], [3, 4]])
In [40]: a[:,2:] *= 0
In [41]: a
Out[41]:
array([[1, 2],
[3, 4]])
In [42]: a = Numeric.array([[1, 2], [3, 4]])
In [43]: a[:,2:] *= 0
In [44]: a
Out[44]:
array([[0, 2],
[0, 4]])
--
Robert Kern
robert.kern at gmail.com
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco