Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-21 Thread Pierre GM
> With the new implementation, the data is not shared for any of the 3 > variations above. The 'copy=True' in MaskedArray.__new__ ensures that data is always copied by default (that's the way I liked it). Most methods that return new masked arrays (__getitem__ and __setitem__, for example) do n

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-21 Thread Michael Sorich
If I make some minor changes (below) to MaskedArray get and setitem from numpyext.maskedarray import * a = array([[1,2,3,4,5],[6,7,8,9,10]], mask=nomask) suba = a[0] suba[1] = masked print a >[[1 -- 3 4 5] > [6 7 8 9 10]] print suba >[1 -- 3 4 5] suba = a[1] suba[1] = 10 print a >[[1 -- 3 4 5] >

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-21 Thread Michael Sorich
Perhaps an example will help explain what I mean For the case of an ndarray if you select a row and then alter the new array, the old array is also changed. from numpy import * a = array([[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]]) suba = a[2] suba[1] = 10 print a print suba --output-- [[ 1 2 3 4 5

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-21 Thread Pierre GM
On Tuesday 21 November 2006 21:11, Michael Sorich wrote: > I think that the new implementation is making a copy of the data with > indexing a MA. This is different from both ndarray and the existing > numpy ma version. Michael, If you check the definition of MaskedArray.__new__, you'll see that t

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-21 Thread Michael Sorich
I think that the new implementation is making a copy of the data with indexing a MA. This is different from both ndarray and the existing numpy ma version. e.g. testma = ma.array([[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]], mask=ma.nomask) testma2 = testma[1] testma2[1] = 20 print testma print testma2

Re: [Numpy-discussion] Quadratic Optimization Problem

2006-11-21 Thread Sebastian Haase
Don't know the complete answer - but try cobyla in scipy (scipy.optimize). -Sebastian On Tuesday 21 November 2006 15:44, amit soni wrote: > Hi, > > I need to do a quadratic optimization problem in python > where the constraints are quadratic and objective function is linear. > Its a convex optimi