Re: [Numpy-discussion] rand argument question

2006-06-03 Thread Sven Schreiber
Robert Kern schrieb: My point is that there is no need to change rand() and randn() to the new interface. The new interface is already there: random.random() and random.standard_normal(). Ok thanks for the responses and sorry for not searching the archives about this. I tend to share

Re: [Numpy-discussion] Don't like the short names like lstsq and irefft

2006-06-16 Thread Sven Schreiber
Alexander Belopolsky schrieb: In my view it is more important that code is easy to read rather than easy to write. Interactive users will disagree, but in programming you write once and read/edit forever :). The insight about this disagreement imho suggests a compromise (or call it a dual

Re: [Numpy-discussion] Don't like the short names like lstsq and irefft

2006-06-16 Thread Sven Schreiber
Alexandre Fayolle schrieb: On Fri, Jun 16, 2006 at 10:43:42AM +0200, Sven Schreiber wrote: Again, there is no defense for abbreviating linear_least_squares because it is unlikely to appear in an expression and waste valuable horisontal space. not true imho; btw, I would suggest ols

[Numpy-discussion] eye and identity: why both?

2006-06-23 Thread Sven Schreiber
identity seems to be a crippled version of eye without any value added, apart from backwards-compatibility; So from a user point of view, which one does numpy recommend? And from a developer point of view (which doesn't really apply to me, of course), should identity maybe become an alias for

Re: [Numpy-discussion] How do I make a diagonal matrix?

2006-06-23 Thread Sven Schreiber
Keith Goodman schrieb: How do I make a NxN diagonal matrix with a Nx1 column vector x along the diagonal? help(n.diag) Help on function diag in module numpy.lib.twodim_base: diag(v, k=0) returns the k-th diagonal if v is a array or returns a array with v as the k-th diagonal if v is

Re: [Numpy-discussion] None as missing value

2006-07-03 Thread Sven Schreiber
Travis Oliphant schrieb: You can use a masked array specifically, or use nan's for missing values and just tell Python you want a floating-point array (because it finds the None object it's guessing incorrectly you want an object array. asarray(x, dtype=float) array([[ 1.,

Re: [Numpy-discussion] None as missing value

2006-07-03 Thread Sven Schreiber
Pierre GM schrieb: I was also a bit surprised at the following behavior: a = numpy.asarray([1,1]) a array([1, 1]) a[0]=numpy.nan a array([0, 1]) Seems to affect only the int_ arrays: a = numpy.asarray([1,1], dtype=float_) a array([1., 1.]) a[0]=numpy.nan a array([nan, 1.

Re: [Numpy-discussion] .T Transpose shortcut for arrays again

2006-07-06 Thread Sven Schreiber
Travis Oliphant schrieb: Bill Baxter wrote: So in short my proposal is to: -- make a.T a property of array that returns a.swapaxes(-2,-1), -- make a.H a property of array that returns a.conjugate().swapaxes(-2,-1) and maybe -- make a.M a property of array that returns numpy.asmatrix(a)

Re: [Numpy-discussion] .T Transpose shortcut for arrays again

2006-07-06 Thread Sven Schreiber
Tim Hochberg schrieb: -) .I for inverse; actually, why not add that to arrays as well as syntactic sugar? Because it encourages people to do the wrong thing numerically speaking? My understanding is that one almost never wants to compute the inverse directly, at least not if

Re: [Numpy-discussion] Call for a vote on .M .A .T .H attributes

2006-07-07 Thread Sven Schreiber
Travis Oliphant schrieb: 1) .T Have some kind of .T attribute +0 (the discussion in the .T thread convinced me it's better to keep the matrix playground as a separate subclass, and so it's not important for me what happens with pure arrays) 2) .H returns .T.conj() +0 3) .M

Re: [Numpy-discussion] What's wrong with matrices?

2006-07-07 Thread Sven Schreiber
Ed Schofield schrieb: Okay ... Ed rolls up his sleeves ... let's make this the thread ;) I'd like to know why you, Sven, and anyone else on the list have gone back to using arrays after trying matrices. What was inconvenient about them? I'd like a nice juicy list. The whole purpose of

Re: [Numpy-discussion] What's wrong with matrices?

2006-07-09 Thread Sven Schreiber
JJ schrieb: - Hello Ed: Here are a couple of examples off the top of my head: a = mat(arange(10)) a.shape = (5,2) b = a.copy() c = hstack((a,b)) # should return a matrix type(c) type 'numpy.ndarray' This hstack bug has been fixed recently.

Re: [Numpy-discussion] suggestions for Matrix-related changes

2006-07-12 Thread Sven Schreiber
JJ schrieb: Travis Oliphant oliphant at ee.byu.edu writes: Svd returns matrices now. Except for the list of singular values which is still an array. Do you want a 1xn matrix instead of an array? Although I'm a matrix supporter, I'm not sure here. Afaics the pro argument is to have

Re: [Numpy-discussion] Args for rand and randn, and workarounds

2006-07-12 Thread Sven Schreiber
Travis Oliphant schrieb: Because of this. I've removed the global_namespace functions (fft, ifft, rand, and randn) from numpy. They are *no longer* in the top-level name-space. If you want them, setup a startup-file appropriately. Ok I'm glad that's settled; however, do I

Re: [Numpy-discussion] generalized_inverse

2006-07-14 Thread Sven Schreiber
Jon Peirce schrieb: There used to be a function generalized_inverse in the numpy.linalg module (certainly in 0.9.2). In numpy0.9.8 it seems to have been moved to the numpy.linalg.old subpackage. Does that mean it's being dropped? Did it have to move? Now i have to add code to my package

Re: [Numpy-discussion] numpy.average(fooArray, axis=0): dropping nans from calculation

2006-07-14 Thread Sven Schreiber
Curzio Basso schrieb: Well try it out and see for yourself ;-) good point :-) But for sums it doesn't make a difference, right... Note that it's called nan*sum* and not nanwhatever. sure, I was still thinking about the first post which was referring to the average... qrz Right,

Re: [Numpy-discussion] r_, c_, hstack, and vstack with 1-d arrays

2006-07-22 Thread Sven Schreiber
Bill Baxter schrieb: Finally, I noticed that the atleast_nd methods return arrays regardless of input type. At a minimum, atleast_1d and atleast_2d on matrices should return matrices. I'm not sure about atleast_3d, since matrices can't be 3d. (But my opinon is that the matrix type should

Re: [Numpy-discussion] matrix-related bug in 1.0b1

2006-07-24 Thread Sven Schreiber
Thanks for helping out on matrix stuff, Bill! Bill Baxter schrieb: On 7/22/06, Sven Schreiber [EMAIL PROTECTED] wrote: Note the array slicing works correct, but the equivalent thing with the matrix does not. Looks like it happened in rev 2698 of defmatrix.py, matrix.__getitem__ method

Re: [Numpy-discussion] matrix-related bug in 1.0b1

2006-07-24 Thread Sven Schreiber
Travis Oliphant schrieb: Sven Schreiber wrote: The change was trying to fix up some cases but did break this one. The problem is that figuring out whether or not to transpose the result is a bit tricky. I've obviously still got it wrong. Ok, this is obviously one of the places were

[Numpy-discussion] fixing diag() for matrices

2006-07-25 Thread Sven Schreiber
Hi, there was a thread about this before, diag() is currently only partly useful if you work with numpy-matrices, because the 1d-2d direction doesn't work, as there are no 1d-numpy-matrices. This is unfortunate because a numpy-matrix with shape (n,1) or (1,m) should be naturally treated as a

Re: [Numpy-discussion] fixing diag() for matrices

2006-07-25 Thread Sven Schreiber
Robert Kern schrieb: Sven Schreiber wrote: Hi, there was a thread about this before, diag() is currently only partly useful if you work with numpy-matrices, because the 1d-2d direction doesn't work, as there are no 1d-numpy-matrices. This is unfortunate because a numpy-matrix with shape (n

Re: [Numpy-discussion] fixing diag() for matrices

2006-07-28 Thread Sven Schreiber
Robert Kern schrieb: Sven Schreiber wrote: That would be fine with me. However, I'd like to point out that after some bug-squashing currently all numpy functions deal with numpy-matrices correctly, afaik. The current behavior of numpy.diag could be viewed as a violation of that principle

Re: [Numpy-discussion] fixing diag() for matrices

2006-07-28 Thread Sven Schreiber
Here's my attempt at summarizing the diag-discussion. The symptom is that currently transforming something like the vector a b c into the diagonal matrix a 0 0 0 b 0 0 0 c is not directly possible if you're working with numpy-matrices (i.e. the vector is of type matrix and has shape (n,1) or

[Numpy-discussion] why is default axis always different?

2006-08-11 Thread Sven Schreiber
Hi, notice the (confusing, imho) different defaults for the axis of the following related functions: nansum(a, axis=-1) Sum the array over the given axis, treating NaNs as 0. sum(x, axis=None, dtype=None) Sum the array over the given axis. The optional dtype argument is the data

Re: [Numpy-discussion] Regarding Matrices

2006-08-14 Thread Sven Schreiber
Hi, Satya Upadhya schrieb: from Numeric import * Well this list is about the numpy package, but anyway... the power function is giving a resultant matrix in which each element of matrix B is raised to the power of 0 so as to make it 1. But, taken as a whole i.e. matrix B to the power of 0

Re: [Numpy-discussion] numpy-1.0b3 under windows

2006-08-23 Thread Sven Schreiber
Jordan Dawe schrieb: I just tried to compile numpy-1.0b3 under windows using mingw. I got this error: ... Any ideas? No, except that I ran into the same problem... Hooray, I'm not alone ;-) -sven - Using Tomcat but

Re: [Numpy-discussion] Version 1.0b3

2006-08-25 Thread Sven Schreiber
[EMAIL PROTECTED] schrieb: Since no one has downloaded 1.0b3 yet, if someone wants to put up the windows version for python2.3 i would be more than happy to be the first person to download it :) I'm sorry, this is *not* for python 2.3, but I posted a build of current svn for python 2.4 under

[Numpy-discussion] memory corruption bug

2006-08-26 Thread Sven Schreiber
Hi, I experienced this strange bug which caused a totally unrelated variable to be overwritten (no exception or error was raised, so it took me while to rule out any errors of my own). The context where this is in is a method of a class (Vecm.getSW()), and the instance of Vecm is created within a

[Numpy-discussion] round() bug

2006-08-26 Thread Sven Schreiber
Hi, is this normal behavior?: import numpy as n; print n.mat(0.075).round(2); print n.mat(0.575).round(2) [[ 0.08]] [[ 0.57]] Again, yesterday's svn on windows. cheers, Sven - Using Tomcat but need to do more? Need to

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Sven Schreiber
in Matlab doesn't have an equivalent in Numpy... like eigs()). --bb On 8/26/06, *Sven Schreiber* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, I experienced this strange bug which caused a totally unrelated variable to be overwritten (no exception or error was raised

Re: [Numpy-discussion] memory corruption bug

2006-08-28 Thread Sven Schreiber
Charles R Harris schrieb: +1. I too suspect that what you have here is a reference/copy problem. The only thing that is local to the class is the reference (pointer), the data is global. Chuck Ok, so you guys were right, turns out that my problem was caused by the fact that a local

Re: [Numpy-discussion] stumped numpy user seeks help

2006-08-30 Thread Sven Schreiber
Mathew Yeates schrieb: My head is about to explode. I have an M by N array of floats. Associated with the columns are character labels ['a','b','b','c','d','e','e','e'] note: already sorted so duplicates are contiguous I want to replace the 2 'b' columns with the sum of the 2 columns.

[Numpy-discussion] reshape: missing arg check?

2006-09-07 Thread Sven Schreiber
Hi, never mind that the following syntax is wrong, but is it supposed to yield that SystemError instead of something more informative? (This is with b5 on win32 and python 2.4.3) b.reshape(3,3,axis = 1) Traceback (most recent call last): File interactive input, line 1, in ? SystemError: NULL

Re: [Numpy-discussion] buggy buggy bugyy: format and casting == BUG in numpy.sum?

2006-09-18 Thread Sven Schreiber
Eric Emsellem schrieb: Hi again after some hours of debugging I finally (I think) found the problem: numpy.sum([[0,1,2],[2,3,4]]) 24 numpy.sum([[0,1,2],[2,3,4]],axis=0) array([2, 4, 6]) numpy.sum([[0,1,2],[2,3,4]],axis=1) array([3, 9]) Isn't the first line supposed to act as

Re: [Numpy-discussion] buggy buggy bugyy: format and casting == BUG in numpy.sum?

2006-09-18 Thread Sven Schreiber
Christopher Barker schrieb: Sven Schreiber wrote: on my 1.0b5 I also see this docstring which indeed seems obsolete. I get this docs string from : import numpy as N N.__version__ '1.0b5' a = N.arange(10) help( a.sum) sum(...) a.sum(axis=None, dtype=None) - Sum

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Sven Schreiber
Travis Oliphant schrieb: If not, shouldn't numpy.sqrt(-1) raise a ValueError instead of returning silently nan? This is user adjustable. You change the error mode to raise on 'invalid' instead of pass silently which is now the default. -Travis Could you please explain how

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread Sven Schreiber
David Cournapeau schrieb: Hi there, I've just managed to nail down a bug which took me nearly two whole days to find: this is coming from an unexpected (at least from me) behaviour of numpy. You have all my sympathy, I tripped over something similar not too long ago, so welcome to the

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread Sven Schreiber
David Cournapeau schrieb: Sven Schreiber wrote: Yes it's intended; as far as I understand the python/numpy syntax, + is an operator, and that triggers assignment by copy (even if you do something trivial as bar = +foo, you get a copy, if I'm not mistaken), So basically, whenever you have

Re: [Numpy-discussion] recent ubuntu package

2006-10-19 Thread Sven Schreiber
Andrew Straw schrieb: The matplotlib .deb on my website is working fine for me with the latest numpy .deb there. If there are any recent patches or anything you are missing, please let me know -- it's not really a big deal to update them, although it might take a couple of days for me to find

[Numpy-discussion] 1.0

2006-10-26 Thread Sven Schreiber
Wow! The list is so quiet despite the fact that the numpy 1.0 release is officially announced on the website, and the download is on sourceforge. Well ok, it was expected and the download counters are all at zero, but still. I want to thank everybody who made this possible very much! I'm not a

Re: [Numpy-discussion] Sorting eigenvalues and vectors together

2006-10-27 Thread Sven Schreiber
jeremito schrieb: argsort() will do the trick. Thanks once again. Jeremy I was a bit confused by your question, maybe you can clarify what you did in the end. IIRC, if the eigenvalues returned by numpy are real numbers (due to the type of the underlying matrix and algorithm), then they

Re: [Numpy-discussion] matrix multiplication (newbie question)

2006-11-08 Thread Sven Schreiber
izak marais schrieb: Hi Sorry if this is an obvious question, but what is the easiest way to multiply matrices in numpy? Suppose I want to do A=B*C*D. The ' * ' operator apparently does element wise multiplication, as does the 'multiply' ufunc. All I could find was the numeric function

Re: [Numpy-discussion] matrix multiplication (newbie question)

2006-11-08 Thread Sven Schreiber
Johannes Loehnert schrieb: Hi, in extension to the previous answers, I'd like to say that it is strongly preferable to use dot(A,dot(B,C)) or dot(dot(A,B),C) instead of A*B*C. The reason is that with dot(), you can control of which operation is performed first, which can *massively*

Re: [Numpy-discussion] Helper function to unroll a array

2006-11-12 Thread Sven Schreiber
Gael Varoquaux schrieb: Hi all, I didn't get any answers to this email. Is it because the proposed addition to numpy is not of any interest to anybody apart from me ? Maybe the way I introduced this is wrong. Please tell me what is wrong with this proposition. Well you didn't

Re: [Numpy-discussion] Could numpy.matlib.nanmax return a matrix?

2006-11-13 Thread Sven Schreiber
Pierre GM schrieb: On Sunday 12 November 2006 17:08, A. M. Archibald wrote: On 12/11/06, Keith Goodman [EMAIL PROTECTED] wrote: Is anybody interested in making x.max() and nanmax() behave the same for matrices, except for the NaN part? That is, make numpy.matlib.nanmax return a matrix instead

Re: [Numpy-discussion] why the difference between ipython and python shell?

2006-11-14 Thread Sven Schreiber
Charles R Harris schrieb: In [1]: from scipy import linalg In [2]: help(linalg.eig) from scipy import linalg help(linalg.eig) Help on function eig in module scipy.linalg.decomp: I expect scipy.linalg and numpy.linalg are different modules containing