Re: [Numpy-discussion] beginner question: rank-1 arrays

2007-10-09 Thread Sven Schreiber
Alan G Isaac schrieb: > On Mon, 8 Oct 2007, Robin apparently wrote: >> However in my code (I am converting from MATLAB) it is >> important to maintain 2d arrays, and keep the difference >> between row and column vectors. > > How about using matrices? > help(numpy.mat) > > hth, > Alan Isaac >

Re: [Numpy-discussion] corrcoef

2007-09-06 Thread Sven Schreiber
John Hunter schrieb: > Is it desirable that numpy.corrcoef for two arrays returns a 2x2 array > rather than a scalar > > In [10]: npy.corrcoef(npy.random.rand(10), npy.random.rand(10)) > Out[10]: > array([[ 1., -0.16088728], >[-0.16088728, 1.]]) > > > I always end up ext

Re: [Numpy-discussion] What is an empty matrix ?

2007-07-05 Thread Sven Schreiber
David Cournapeau schrieb: > Well, I think nobody argues that scipy function should crash whatever > input you give :). The problem is more how to treat them. For example, > using numpy.linalg.pinv crashes numpy right now, det and fft do not > work, and norm returns 0. This is seems inconcistent

Re: [Numpy-discussion] Familiar w/ reduce ?

2007-06-26 Thread Sven Schreiber
Pierre GM schrieb: > All, > I have a (m_1+1,m_2+1) matrix of 0 and 1, and I need to compute a second > matrix U by recurrence. > A double-loop as such > # > U = empty((m_1+1, m_2+1)) > U[:,0] = C[:,0] > U[0,:] = C[0,:] > for i in range(1,m_1+1): > for j in range(1,m

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-20 Thread Sven Schreiber
Travis Oliphant schrieb: > Sturla Molden wrote: >> >>> x = numpy.arange(100).reshape((1,10,10)) >> >> >>> x[0,:,numpy.arange(5)].shape >> (5, 10) >> >> >>> x[:,:,numpy.arange(5)].shape >> (1, 10, 5) >> >> >> It looks like a bug that needs to be squashed. >> > > These are both correct. See m

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Sven Schreiber
Sturla Molden schrieb: > > >>> x = numpy.arange(100).reshape((1,10,10)) > > >>> x[0,:,numpy.arange(5)].shape > (5, 10) > > >>> x[:,:,numpy.arange(5)].shape > (1, 10, 5) > > > It looks like a bug that needs to be squashed. > > S.M. And you already had me convinced ;-) I'm still curious wh

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Sven Schreiber
Sven Schreiber schrieb: > Tom K. schrieb: >>>>> h = zeros((1, 4, 100)) >>>>> h[0,:,arange(14)].shape >> (14, 4) >> > > After reading section 3.4.2.1 of the numpy book, I also still don't > expect this result. So if it's not a bug, I&

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-16 Thread Sven Schreiber
Tom K. schrieb: h = zeros((1, 4, 100)) h[0,:,arange(14)].shape > (14, 4) > After reading section 3.4.2.1 of the numpy book, I also still don't expect this result. So if it's not a bug, I'd be glad if some expert could explain why not. Thanks, Sven __

Re: [Numpy-discussion] VMWare Virtual Appliance of Ubuntu with numpy, scipy, matplotlib, and ipython available

2007-06-11 Thread Sven Schreiber
Alex schrieb: > I run VMWare Player and it works fine - easy to setup and easy to > setup a Matlab replacement. I only wonder how to transfer files > between the Windows XP and the Ubuntu VM? Apart from using usb sticks (AFAIK VMware still has issues with usb 2.0 though) I think the experts usual

Re: [Numpy-discussion] complex arrays and ctypes

2007-05-28 Thread Sven Schreiber
Albert Strasheim schrieb: > Hello > > On Sun, 27 May 2007, Sven Schreiber wrote: > >> Hi, >> I am wondering whether it's possible to pass (and get back) arrays of >> complex floats via ctypes. >> >> To be concrete, I have managed to access la

[Numpy-discussion] complex arrays and ctypes

2007-05-27 Thread Sven Schreiber
Hi, I am wondering whether it's possible to pass (and get back) arrays of complex floats via ctypes. To be concrete, I have managed to access lapack's dgges (Fortran) function using ctypes (thanks to a related example on this list), and now I would like to do the same with the complex version zgge

Re: [Numpy-discussion] Median / mean functionality confusing?

2007-05-27 Thread Sven Schreiber
Matthew Brett schrieb: > Can I resurrect this thread then by agreeing with Chris, and my > original post, that it would be better if median had the same behavior > as mean, accepting axis and dtype as inputs? Well I'm not a developer but I guess there is a backwards-compatibility issue here. I mea

Re: [Numpy-discussion] Median / mean functionality confusing?

2007-05-24 Thread Sven Schreiber
Christopher Barker schrieb: > Matthew Brett wrote: >>> Regarding dtype, I disagree. Why do you want to force the result to be a >>> float? > > well, what's the median of (1, 2, 3, 4) ? > > I learned it is 2.5 > > (Zar, Jerrold H. 1984. Biostatistical Analysis. Prentice Hall.) Is that the semina

Re: [Numpy-discussion] Median / mean functionality confusing?

2007-05-24 Thread Sven Schreiber
Matthew Brett schrieb: > Hi, > > Does anyone else find this unexpected? > > In [93]: import numpy as N > In [94]: a = N.arange(10).reshape(5,2) > In [95]: N.mean(a) > Out[95]: 4.5 > In [96]: N.median(a) > Out[96]: array([4, 5]) > > i.e. shouldn't median have the same axis, dtype, default axis=No

Re: [Numpy-discussion] NumPy 1.0.2 released

2007-04-04 Thread Sven Schreiber
Charles R Harris wrote: > > > On 4/3/07, *Travis Oliphant* <[EMAIL PROTECTED] > > NumPy 1.0.2 was released yesterday (4-02-07). Get it by following the > And thanks for getting it out. > >From me too! -sven ___ Numpy-discussion mailing list

Re: [Numpy-discussion] Further matrix oddities: no inner product

2007-03-29 Thread Sven Schreiber
Charles R Harris schrieb: > > Nope, vdot doesn't work for row and column vectors. So there is *no* > builtin inner product that works for matrices. I wonder if we should > have one, and if so, what it should be called. I think that vdot should > probably be modified to do the job. There is also

Re: [Numpy-discussion] defmatrix.py

2007-03-27 Thread Sven Schreiber
Travis Oliphant schrieb: > O.K. So, the problem is that when I defined matrix multiplication, I > mistakenly believed that dot always interpreted 1-d arrays as row > vectors which it is now clear it doesn't. > > I think this led to the issues. > > So, making dot always return arrays seems li

Re: [Numpy-discussion] matrix indexing question

2007-03-26 Thread Sven Schreiber
Alan G Isaac schrieb: > > What feels wrong: iterating over a container does not give > access to the contained objects. This is not Pythonic. If you iterate over the rows of the matrix, it feels natural to me to get the row vectors -- and as you know a 1d-array does not contain the information

Re: [Numpy-discussion] Modular toolkit for Data Processing 2.1 released!

2007-03-26 Thread Sven Schreiber
Tiziano Zito schrieb: > The optional symeig module contains a Python wrapper for the LAPACK > functions to solve the standard and generalized eigenvalue problems > for symmetric (hermitian) positive definite matrices. Those > specialized algorithms give an important speed-up with respect to the >

Re: [Numpy-discussion] matrix indexing question

2007-03-26 Thread Sven Schreiber
Alan G Isaac schrieb: > Oooops, they should match of course. :: > >>> X[1] > array([3,4]) > >>> X[1,:] > matrix([[3, 4]]) > > But again the point is: > indexing for submatrices should produce matrices. > Normal Python indexing should access the constituent arrays. > I think this

Re: [Numpy-discussion] Matlab -> NumPy translation and indexing

2007-03-20 Thread Sven Schreiber
David Koch schrieb: > Hi, > > naive question - how do I get an overview over everything to do with > "sparse functionality" in SciPy 0.5.2 ... I can't find any documentation > anywhere. > First of all I would recommend to start a new and properly named thread for that good luck, sven __

Re: [Numpy-discussion] Matlab -> NumPy translation and indexing

2007-03-14 Thread Sven Schreiber
David Koch schrieb: > > In Python, I tried: > > A = empty((0,0)) > while > A = concatenate((A, array([someScalarValue])), 1) > end > > which returns an error since the shape of the empty A does not match the > vector I want to concatenate with. Any way to get around this without > havi

Re: [Numpy-discussion] linalg.eigh orders eigenvalues/eigenvectors differently than linalg.eig

2007-02-19 Thread Sven Schreiber
Zachary Pincus schrieb: > Hello all, > > It seems that the 'eigh' routine from numpy.linalg does not follow > the same convention as numpy.linalg.eig in terms of the order of the > returned eigenvalues. (And thus eigenvectors as well...) I was told on this list that the ordering should not be

Re: [Numpy-discussion] force column vector

2007-02-07 Thread Sven Schreiber
Christopher Barker schrieb: > Christian wrote: >> when creating an ndarray from a list, how can I force the result to be >> 2d *and* a column vector? So in case I pass a nested list, there will be no >> modification of the shape and when I pass a simple list, it will be >> converted to a 2d column

Re: [Numpy-discussion] force column vector

2007-02-07 Thread Sven Schreiber
Christian schrieb: > Hi, > > when creating an ndarray from a list, how can I force the result to be > 2d *and* a column vector? So in case I pass a nested list, there will be no > modification of the shape and when I pass a simple list, it will be > converted to a 2d column vector. I can only thi

Re: [Numpy-discussion] Cutting 1.0.2 release

2007-02-01 Thread Sven Schreiber
Travis Oliphant schrieb: > I think it's time for the 1.0.2 release of NumPy. > > What outstanding issues need to be resolved before we do it? > Hi, I just used real_if_close for the first time, and promptly discovered that it turns matrix input into array output: >>> import numpy as n >>> n._

Re: [Numpy-discussion] kron bug with zero-length dimensions?

2007-01-27 Thread Sven Schreiber
Sven Schreiber schrieb: > Hi, > > the kron(a,b) function seems to allow shapes such as (0,x) or (y,0) only > for the second argument b, not for the first argument a. (See below for > examples.) > > Maybe it's too harsh to call it a bug because the result is typically &g

Re: [Numpy-discussion] added 1.0.1 release notes to wiki

2007-01-27 Thread Sven Schreiber
Martin Spacek schrieb: > Just a note that I've copied over the 1.0.1 release notes from SourceForge: > > http://sourceforge.net/project/shownotes.php?group_id=1369&release_id=468153 > > over to the wiki: > > http://scipy.org/ReleaseNotes/NumPy_1.0 Thank you! > > Should 1.0.1 get its own page,

[Numpy-discussion] kron bug with zero-length dimensions?

2007-01-25 Thread Sven Schreiber
Hi, the kron(a,b) function seems to allow shapes such as (0,x) or (y,0) only for the second argument b, not for the first argument a. (See below for examples.) Maybe it's too harsh to call it a bug because the result is typically not defined mathematically. But then why differentiate between allo

Re: [Numpy-discussion] ANN: MaskedArray as a subclass of ndarray - followup

2007-01-19 Thread Sven Schreiber
Matt Knox schrieb: > > I am definitely in favor of the new maskedarray implementation. I've been > working with Pierre on a time series module which is a subclass of the new > masked array implementation, and having it as a subclass of ndarray definitely > has advantages (and no real disadvantage

[Numpy-discussion] 1.0.1 release notes missing?

2007-01-05 Thread Sven Schreiber
I found the release notes on the way to 1.0 very useful. However, they stop at 1.0, and I also didn't find any in the 1.0.1 source distribution. Do they exist somewhere? Or are there really only bugfixes in 1.0.1? That information would be useful, too. Thank you, Sven

Re: [Numpy-discussion] newbie: attempt at data frame

2007-01-03 Thread Sven Schreiber
Sven Schreiber schrieb: > Hi Vincent, of course it depends a little on how exactly your csv file > looks like, but if you just have column headers and the actual data, you > might try something like the following: > Ok sorry the previous thing doesn't work, I also stumbled

Re: [Numpy-discussion] newbie: attempt at data frame

2007-01-03 Thread Sven Schreiber
Vincent Nijs schrieb: > If there is an easy way to read array data + variable names using the csv > module it would be great if that could be added to cookbook/InputOutput. I > couldn't figure out how to do it. > > Hi Vincent, of course it depends a little on how exactly your csv file looks like

Re: [Numpy-discussion] Scalar values with a matrix

2007-01-02 Thread Sven Schreiber
Charles R Harris schrieb: > > mat(5) is a 1x1 matrix: > > In [5]: mat(5) > Out[5]: matrix([[5]]) > > so the error is valid. If you want to do a scalar multiply try > > In [6]: amat*5 > Out[6]: > matrix([[ 0, 5, 10, 15], > [20, 25, 30, 35], > [40, 45, 50, 55]]) Or you can do m

Re: [Numpy-discussion] Time series: lag function

2006-12-27 Thread Sven Schreiber
Vincent Nijs schrieb: > I am tryin to convert some of my time-series code written in Ox to > scipy/numpy (e.g., unit root tests, IRFs, cointegration, etc). Two key > functions I need for this are 'lag' and 'diff'. 'diff' is available but > 'lag' is apparently not. > > Below is my attempt at a lag

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-24 Thread Sven Schreiber
Robert Kern schrieb: > Rather, to put it accurately, numpy should not get large chunks of scipy > functionality that require FORTRAN dependencies for reasons that should be > obvious from that description. scipy.stats.distributions is just such a chunk. I was probably not very clear, I was refe

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-22 Thread Sven Schreiber
Robert Kern schrieb: > Pierre GM wrote: >> Talking about that, what happened to these projects of modular installation >> of scipy ? Robert promised us last month to explain what went wrong with his >> approach, but never had the time... > > I created a module (scipy_subpackages.py, IIRC) next

Re: [Numpy-discussion] Automatic matrices

2006-12-21 Thread Sven Schreiber
Keith Goodman schrieb: > How about diag? > There was a thread about this (in which you participated, I believe); for matrices you should now use m.diagonal() I think. So diag doesn't qualify. -sven ___ Numpy-discussion mailing list Numpy-discussion@sc

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-21 Thread Sven Schreiber
A. M. Archibald schrieb: > On 20/12/06, Alan G Isaac <[EMAIL PROTECTED]> wrote: >> This is my "most missed" functionality in NumPy. >> (For now I feel cannot ask students to install SciPy.) >> Although it is a slippery slope, and I definitely do not >> want NumPy to slide down it, I would certainl

Re: [Numpy-discussion] Automatic matrices

2006-12-21 Thread Sven Schreiber
Sven Schreiber schrieb: > Keith Goodman schrieb: > >> There are many numpy functions that will take a matrix as input but >> return an array. >> >> The nan functions (nanmin, nanmax, nanargmin, nanargmax, nansum) are an >> example. >> > > So t

Re: [Numpy-discussion] Automatic matrices

2006-12-16 Thread Sven Schreiber
Paulo Jose da Silva e Silva schrieb: > > Obs: I remember reading somewhere in the list that we can change the > behavior of numpy to make it return matrices as default, even in calls > for functions like zeros or ones. I don't have the reference now. Anyhow > I wanted a solution that can make any

Re: [Numpy-discussion] Automatic matrices

2006-12-16 Thread Sven Schreiber
Keith Goodman schrieb: > > There are many numpy functions that will take a matrix as input but > return an array. > > The nan functions (nanmin, nanmax, nanargmin, nanargmax, nansum) are an > example. > So that would be a bug IMHO and should be filed as a ticket. I will do that eventually if

Re: [Numpy-discussion] Automatic matrices

2006-12-15 Thread Sven Schreiber
Paulo Jose da Silva e Silva schrieb: > > However, after trying to use the matrix class I have came across a major > roadblock: many numpy/scipy functions return an array by default and not > matrices. Then, we need then to add many conversion calls to the 'mat' > function in our code. This is als

Re: [Numpy-discussion] empty data matrix (are they really empty ?)

2006-12-14 Thread Sven Schreiber
[you probably should have started a new thread instead of replying to another one...] Giorgio Luciano schrieb: > In the old file I created a matrix on the fly. I know that Numpy and > python cannot do that so I found a workaround I'm not sure what you mean what numpy cannot do, but... > here

Re: [Numpy-discussion] numpy book

2006-12-12 Thread Sven Schreiber
Travis Oliphant schrieb: >> Note that this is not a request to Travis to send me the latest version >> by private email. That would be inefficient and my need is not that >> urgent. Nevertheless I think that issue should be settled. >> >> > There will be an update, soon. I'm currently working on