Re: [Numpy-discussion] To wrap or not to wrap.

2008-04-26 Thread Charles R Harris
On Sat, Apr 26, 2008 at 10:31 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Sat, Apr 26, 2008 at 11:23 PM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > I'm working through the linalg module. There is currently variation as > to > > whether or not eigenvalues/singular_values/

Re: [Numpy-discussion] What is __array_wrap__ supposed to do?

2008-04-26 Thread Charles R Harris
On Sat, Apr 26, 2008 at 10:31 PM, Andreas Klöckner <[EMAIL PROTECTED]> wrote: > On Samstag 26 April 2008, Charles R Harris wrote: > > I'm working through the linalg module. There is currently variation as > to > > whether or not eigenvalues/singular_values/residuals, are returned as > > arrays or

Re: [Numpy-discussion] What is __array_wrap__ supposed to do?

2008-04-26 Thread Andreas Klöckner
On Samstag 26 April 2008, Charles R Harris wrote: > I'm working through the linalg module. There is currently variation as to > whether or not eigenvalues/singular_values/residuals, are returned as > arrays or as matrices. I'm leaning towards making them all matrices. What > do you think? IMO, the

Re: [Numpy-discussion] To wrap or not to wrap.

2008-04-26 Thread Robert Kern
On Sat, Apr 26, 2008 at 11:23 PM, Charles R Harris <[EMAIL PROTECTED]> wrote: > Hi All, > > I'm working through the linalg module. There is currently variation as to > whether or not eigenvalues/singular_values/residuals, are returned as > arrays or as matrices. I'm leaning towards making them all

[Numpy-discussion] To wrap or not to wrap.

2008-04-26 Thread Charles R Harris
Hi All, I'm working through the linalg module. There is currently variation as to whether or not eigenvalues/singular_values/residuals, are returned as arrays or as matrices. I'm leaning towards making them all matrices. But I expect masked arrays will also be preserved and I don't know what that

Re: [Numpy-discussion] What is __array_wrap__ supposed to do?

2008-04-26 Thread Charles R Harris
On Sat, Apr 26, 2008 at 9:29 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Sat, Apr 26, 2008 at 10:04 PM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > > > On Sat, Apr 26, 2008 at 8:59 PM, Robert Kern <[EMAIL PROTECTED]> > wrote: > > > > > > On Sat, Apr 26, 2008 at 9:27 PM, Charles R Harris

Re: [Numpy-discussion] What is __array_wrap__ supposed to do?

2008-04-26 Thread Robert Kern
On Sat, Apr 26, 2008 at 10:04 PM, Charles R Harris <[EMAIL PROTECTED]> wrote: > > On Sat, Apr 26, 2008 at 8:59 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > > > > On Sat, Apr 26, 2008 at 9:27 PM, Charles R Harris > > <[EMAIL PROTECTED]> wrote: > > > Because it doesn't do what it says it does. > > >

Re: [Numpy-discussion] What is __array_wrap__ supposed to do?

2008-04-26 Thread Charles R Harris
On Sat, Apr 26, 2008 at 8:59 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Sat, Apr 26, 2008 at 9:27 PM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > Because it doesn't do what it says it does. > > > Here is what the docstring says: > > > > Help on method_descriptor: > > > > __array_wrap__(

Re: [Numpy-discussion] What is __array_wrap__ supposed to do?

2008-04-26 Thread Robert Kern
On Sat, Apr 26, 2008 at 9:27 PM, Charles R Harris <[EMAIL PROTECTED]> wrote: > Because it doesn't do what it says it does. > Here is what the docstring says: > > Help on method_descriptor: > > __array_wrap__(...) > a.__array_wrap__(obj) -> Object of same type as a from ndarray obj. Python typ

[Numpy-discussion] What is __array_wrap__ supposed to do?

2008-04-26 Thread Charles R Harris
Because it doesn't do what it says it does. In [31]: b.__array_wrap__(a).dtype Out[31]: dtype('float64') In [32]: a.__array_wrap__(b).dtype Out[32]: dtype('int8') In [33]: a Out[33]: array([[ 1., 1., 1.], [ 1., 1., 1.], [ 1., 1., 1.]]) In [34]: b Out[34]: array([[1, 1, 1],

Re: [Numpy-discussion] Threading question for Travis

2008-04-26 Thread Travis E. Oliphant
Charles R Harris wrote: > > > On Sat, Apr 26, 2008 at 11:21 AM, Travis E. Oliphant > <[EMAIL PROTECTED] > wrote: > > Charles R Harris wrote: > > Travis, > > > > Is this correct? > > > Yes. > > NPY_LOOP_BEGIN_THREADS; > > switch(loop

Re: [Numpy-discussion] Threading question for Travis

2008-04-26 Thread Charles R Harris
On Sat, Apr 26, 2008 at 11:21 AM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Charles R Harris wrote: > > Travis, > > > > Is this correct? > > > Yes. > > NPY_LOOP_BEGIN_THREADS; > > switch(loop->meth) { > > case ONE_UFUNCLOOP: > > /* > > * Everything is contiguous,

Re: [Numpy-discussion] [python] Re: Request for advice: project to get NumPy working in IronPython

2008-04-26 Thread David
Michael Foord voidspace.org.uk> writes: > > are you really going to run matrix inversion on the CLR in a browser?) Yes! ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] access ndarray in C++

2008-04-26 Thread Hoyt Koepke
Let me say also that I tried using boost.python a while back to interface numpy with c++, and, while I got some things working, I found the distribution and packaging end of things an order of magnitude more complicated than what I found with weave. Since weave is built into scipy, as well as blit

Re: [Numpy-discussion] leaving matrix indexing discussion

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 03:13:22PM -0400, Alan G Isaac wrote: > At this point, I am starting to feel that I have abused my > interlocutors. So I will withdraw from the conversation. Let us continue this discussion after numpy 1.1 is release, with no feeling of urgency. Gaël _

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, "Travis E. Oliphant" apparently wrote: > I'm not personally persuaded by the iteration argument, because we can > change iteration independently of mapping (__getitem__) access. Would that not impose another deviation from array behavior? I just do not see the purpose. I s

[Numpy-discussion] leaving matrix indexing discussion

2008-04-26 Thread Alan G Isaac
At this point, I am starting to feel that I have abused my interlocutors. So I will withdraw from the conversation. Apologies to those who feel I should have done so earlier. The core issues are, I think, on the discussion page. http://www.scipy.org/MatrixIndexing> I hope people will read it befo

Re: [Numpy-discussion] reshape docstrings conflicting

2008-04-26 Thread Pauli Virtanen
Hi Chuck, Charles R Harris wrote: [clip] > I noticed that you removed the ReST markup of the tables in sort > documentation. I think you should leave it in. Also the simplified table syntax header 1 header 2 header 3 line 1a line 1b line 1c

Re: [Numpy-discussion] prerelease proposal for matrix behavior

2008-04-26 Thread Alan G Isaac
> Alan G Isaac wrote: >> OK, we are not converging in time for the release. >> So can we at least raise a TypeError on scalar >> indexing of matrices, so that we remain free to choose >> the ultimate behavior? On Fri, 25 Apr 2008, "Travis E. Oliphant" apparently wrote: > I think this is wise

Re: [Numpy-discussion] reshape docstrings conflicting

2008-04-26 Thread Jarrod Millman
On Sat, Apr 26, 2008 at 11:24 AM, Charles R Harris <[EMAIL PROTECTED]> wrote: > I noticed that you removed the ReST markup of the tables in sort > documentation. I think you should leave it in. I haven't tried to render it, but I think he just changed the tables from ReST's grid table to ReST's si

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Travis E. Oliphant
Alan G Isaac wrote: > On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > >> For me this is wrong. list and tuples are not 2D. Numpy >> arrays happen to offer this feature, but you should not >> use it do to multiple dimension indexing. >> > > But there is no proposal that people sho

Re: [Numpy-discussion] adding ``rows`` and ``columns`` attributes to matrices

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 02:42:04PM -0400, Alan G Isaac wrote: > As others have observed: why break array > behavior for no purpose? Because the behavior you are relying on is IMHO a coincidence. Are other people on the mailing list relying on this? I strongly think it is wrong, but maybe I am the

Re: [Numpy-discussion] adding ``rows`` and ``columns`` attributes to matrices

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > for row in A.rows(): >for col in row.cols() Actually I am in favor of adding ``rows`` and ``cols`` attributes to allow such iteration. The only thing is, I say these should be matrices (i.e., 2d). I.e., this should provide a symmetri

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 02:32:01PM -0400, Alan G Isaac wrote: > A list of lists is naturally conceived as 2d, > which is why you can initialize a 2d matrix > with a list of lists. > Try a Google search on "python two dimensional list" > to confirm that I am not promoting an anomalous view. > So I

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
>> On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: >>> I don't see where you get your universality. > On Sat, Apr 26, 2008 at 11:15:14AM -0400, Alan G Isaac > wrote: >> Lists, tuples, arrays ... >> Where is the exception? >> Only matrices are the only 2d container I can >> think of tha

Re: [Numpy-discussion] reshape docstrings conflicting

2008-04-26 Thread Charles R Harris
On Sat, Apr 26, 2008 at 11:29 AM, Pauli Virtanen <[EMAIL PROTECTED]> wrote: > Hi all, > > The ndarray.reshape docstring claims: > >"Also always returns a view or raises a ValueError if that is >impossible." > > whereas fromnumeric.reshape claims: > >"This will be a new view

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 02:01:45PM -0400, Alan G Isaac wrote: > >>> A > matrix([[1, 2], > [ 3, 4]]) > >>> A = np.mat(x) > >>> for row in A: > ... for col in row: > ... print col > ... > [[1 2]] > [[3 4]] > So are you saying that one should not

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > For me this is wrong. list and tuples are not 2D. Numpy > arrays happen to offer this feature, but you should not > use it do to multiple dimension indexing. But there is no proposal that people should index like this. The underlying issue

[Numpy-discussion] reshape docstrings conflicting

2008-04-26 Thread Pauli Virtanen
Hi all, The ndarray.reshape docstring claims: "Also always returns a view or raises a ValueError if that is impossible." whereas fromnumeric.reshape claims: "This will be a new view object if possible; otherwise, it will be a copy." while the code paths for b

Re: [Numpy-discussion] Threading question for Travis

2008-04-26 Thread Travis E. Oliphant
Charles R Harris wrote: > Travis, > > Is this correct? > Yes. > NPY_LOOP_BEGIN_THREADS; > switch(loop->meth) { > case ONE_UFUNCLOOP: > /* > * Everything is contiguous, notswapped, aligned, > * and of the right type. -- Fastest. > * Or if not contiguou

Re: [Numpy-discussion] tests in distutils/exec_command.py

2008-04-26 Thread Pearu Peterson
On Sat, April 26, 2008 7:53 pm, Zbyszek Szmek wrote: > Hi, > while looking at test coverage statistics published Stéfan van der Walt > at http://mentat.za.net/numpy/coverage/, I noticed that the > least-covered file, numpy/distutils/exec_command.py has it's own > test routines, e.g.: > def test_svn

[Numpy-discussion] tests in distutils/exec_command.py

2008-04-26 Thread Zbyszek Szmek
Hi, while looking at test coverage statistics published Stéfan van der Walt at http://mentat.za.net/numpy/coverage/, I noticed that the least-covered file, numpy/distutils/exec_command.py has it's own test routines, e.g.: def test_svn(**kws): s,o = exec_command(['svn','status'],**kws) ass

Re: [Numpy-discussion] Movement of ma breaks matplotlib

2008-04-26 Thread Jarrod Millman
On Fri, Apr 25, 2008 at 10:19 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > In the upcoming release of numpy. numpy.core.ma ceases to exist. One > must use numpy.ma (for the new interface) or numpy.oldnumeric.ma (for > the old interface). This has the unfortunate effect of breaking > matplotl

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 11:15:14AM -0400, Alan G Isaac wrote: > On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > > I don't see where you get your universality. > Lists, tuples, arrays ... > Where is the exception? > Only matrices are the only 2d container I can > think of that are broken t

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 11:13:12AM -0400, Alan G Isaac wrote: > On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > > I claim b is more important than a. IMHO, a is plain > > wrong: you should't be indexing x with x[0][0]. > Why?? Because a 2D object is not a list of list. It is more than

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > We may desagree on what is Right, but the breaks backward > compatibility, and thus is a breakage and should be given > a lot of thought. I agree with this. I am a matrix user, and I have given it a lot of thought. I have been making t

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > I don't see where you get your universality. Lists, tuples, arrays ... Where is the exception? Only matrices are the only 2d container I can think of that are broken this way. Cheers, Alan Isaac __

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > I claim b is more important than a. IMHO, a is plain > wrong: you should't be indexing x with x[0][0]. Why?? Would you say this about a 2d array? Why the difference? The core argument has been that it is a **basic expectation** of the be

Re: [Numpy-discussion] prerelease proposal for matrix behavior

2008-04-26 Thread Alan G Isaac
On Fri, 25 Apr 2008, "Travis E. Oliphant" apparently wrote: > At this point, I'm leaning in the direction of the > RowVector / ColumnVector approach (even if these are not > really advertised and just used during indexing). I believe that this conflicts with submatrix extraction. Details follow

Re: [Numpy-discussion] prerelease proposal for matrix behavior

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Bill Baxter apparently wrote: > Any change to the behavior of x[0] for matrices is going to break a lot of > code. OK, how about a warning then? E.g., see attached patch. Cheers, Alan --- defmatrix.old Sat Apr 26 09:34:11 2008 +++ defmatrix.pySat Apr 26 09:37

Re: [Numpy-discussion] access ndarray in C++

2008-04-26 Thread Gael Varoquaux
On Wed, Apr 23, 2008 at 09:47:46PM -0400, Andreas Klöckner wrote: > > Any numpy-specific stuff for sip? > Not as far as I'm aware. In fact, I don't know of any uses of sip outside of > Qt/KDE-related things. Airbus uses it for heavy numerical work. They claim they have benchmarked all the tools

[Numpy-discussion] Threading question for Travis

2008-04-26 Thread Charles R Harris
Travis, Is this correct? NPY_LOOP_BEGIN_THREADS; switch(loop->meth) { case ONE_UFUNCLOOP: /* * Everything is contiguous, notswapped, aligned, * and of the right type. -- Fastest. * Or if not contiguous, then a single-stride * increment move

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Fri, Apr 25, 2008 at 01:40:29PM -0400, Alan G Isaac wrote: > On Fri, 25 Apr 2008, Stéfan van der Walt wrote: > > workaround would break x[0] == x[0,:] > But there is not universal agreement that x[0] == x[0,:] is > desirable. In contrast, there *is* universal agreement that > x[0][0]==x[0,0

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Fri, Apr 25, 2008 at 01:04:53PM -0400, Alan G Isaac wrote: > On Fri, 25 Apr 2008, Stéfan van der Walt apparently wrote: > > The agreement was: > > a) That x[0][0] should be equal to x[0,0] and > > b) That x[0,:] should be equal to x[0] (as for ndarrays) > 1. This is **not** what I understood a

Re: [Numpy-discussion] 2D array to 3D

2008-04-26 Thread Robert Kern
2008/4/25 tournesol <[EMAIL PROTECTED]>: > Hi All. > > Is there a easy way to insert 1D(j) array into another 2D array(B:jxk) > and conver B to B:ixjxk ? > > ex:) > > >>> from numpy import * > >>> a=arange(4) > >>> a > array([0, 1, 2, 3]) > >>> b=arange(9) > >>> b.shape=3,3 > >>> b > arr