Re: [Numpy-discussion] numpy release

2008-04-23 Thread Alan G Isaac
On Wed, 23 Apr 2008, Bill Spotz apparently wrote: > Gains: (1) non-scalar extractions from linear algebra > objects ARE and BEHAVE like linear algebra objects; I believe this is not a gain, since there is a standard way to do this now, which would remain under the second proposal. > (2) a clear

Re: [Numpy-discussion] [SciPy-dev] stats.mstats & stats.mmorestats

2008-04-23 Thread Jarrod Millman
On Mon, Apr 14, 2008 at 11:55 AM, Pierre GM <[EMAIL PROTECTED]> wrote: > I just committed two modules (and the corresponding unittests) to the > scipy.stats package. Feel free to test and send some feedback. These packages > are meant to replace numpy.ma.mstats and numpy.ma.morestats: may I go a

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Timothy Hochberg
[CHOP] The proposals thus far don't address two of the major issues I have with the matrix class: 1. The matrices and arrays should become more alike if possible and should share more of the same code base. From what I've seen, the people who write the code (for numpy) don't actually use

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

2008-04-23 Thread Andreas Klöckner
On Mittwoch 23 April 2008, Christopher Barker wrote: > What's the status of the Boost array object? maintained? updated for > recent numpy? The numeric.hpp included in Boost.Python is a joke. It does not use the native API. PyUblas [1] fills this gap, by allowing you to use Boost.Ublas on the C+

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Stéfan van der Walt
2008/4/23 Christopher Barker <[EMAIL PROTECTED]>: > Aside from the fact that someone needs to write the code -- why don't > people like the row/column vector idea? It just feels so natural to me: I wrote most of the code last week (see the previous thread on the mailing list for a patch). It cu

[Numpy-discussion] Fixing/breaking histogram for numpy 1.1

2008-04-23 Thread Jarrod Millman
On Wed, Apr 23, 2008 at 3:20 PM, David Huard <[EMAIL PROTECTED]> wrote: > I haven't found a way to fix histogram reliably without breaking the current > behavior. There is a patch attached to the ticket, if the decision is to > break histogram. +1 As far as I am concerned it seems like histogram i

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Bill Spotz
On Apr 23, 2008, at 3:55 PM, Christopher Barker wrote: >> For matrix x, should x[0].A[0] == x.A[0][0]? That is, should the >> array >> attribute of a Row Vector or Column Vector be 1d? > > Absolutely -- a vector is a 1-d array. The only difference here is > that > we can preserve the concept o

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Christopher Barker
Alan Isaac wrote: > I have updated http://www.scipy.org/MatrixIndexing> > to reflect this change (and its provisional status). Thanks for writing this up -- it really clarifies what's being proposed. A few comments on that write up: > For matrix x, should x[0].A[0] == x.A[0][0]? That is, should

Re: [Numpy-discussion] "aligned" matrix / ctypes

2008-04-23 Thread Anne Archibald
On 23/04/2008, Zachary Pincus <[EMAIL PROTECTED]> wrote: > Hi, > > Thanks a ton for the advice, Robert! Taking an array slice (instead of > trying to set up the strides, etc. myself) is a slick way of getting > this result indeed. It's worth mentioning that there was some discussion of adding a

Re: [Numpy-discussion] "aligned" matrix / ctypes

2008-04-23 Thread Robert Kern
On Wed, Apr 23, 2008 at 4:26 PM, Zachary Pincus <[EMAIL PROTECTED]> wrote: [ I wrote] > > To solve the initial alignment, you overallocate a 1D array by 3 bytes > > and find the offset from the allocated initial address which is > > correctly aligned. > > Sorry -- I haven't had to ever concern

Re: [Numpy-discussion] "aligned" matrix / ctypes

2008-04-23 Thread Zachary Pincus
Hi, Thanks a ton for the advice, Robert! Taking an array slice (instead of trying to set up the strides, etc. myself) is a slick way of getting this result indeed. >> I need to allocate a numpy array that I will then pass to a camera >> driver (via ctypes) so that the driver can fill the arra

Re: [Numpy-discussion] "aligned" matrix / ctypes

2008-04-23 Thread Robert Kern
On Wed, Apr 23, 2008 at 2:10 PM, Zachary Pincus <[EMAIL PROTECTED]> wrote: > Hello all, > > I need to allocate a numpy array that I will then pass to a camera > driver (via ctypes) so that the driver can fill the array with pixels. > The catch is that the driver requires that rows of pixels star

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Alan Isaac
On Wed, 23 Apr 2008, Stéfan van der Walt wrote: > Done in r5072. Much appreciated. I have updated http://www.scipy.org/MatrixIndexing> to reflect this change (and its provisional status). Alan ___ Numpy-discussion mailing list Numpy-discussion@scipy.

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

2008-04-23 Thread Robert Kern
On Wed, Apr 23, 2008 at 3:46 PM, Thomas Hrabe <[EMAIL PROTECTED]> wrote: > I have discovered a bug in ndarrayobject.h by the way. I do not know which > numpy version we have installed here, but when compiling my c code with > -pendantic I got this error: > > > /home/global/python32/lib/python2.4/s

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

2008-04-23 Thread Thomas Hrabe
Finally! http://scipy.org/Cookbook/C_Extensions is a nice example. I have discovered a bug in ndarrayobject.h by the way. I do not know which numpy version we have installed here, but when compiling my c code with -pendantic I got this error: /home/global/python32/lib/python2.4/site-packages/n

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Stéfan van der Walt
2008/4/23 Jarrod Millman <[EMAIL PROTECTED]>: > On Wed, Apr 23, 2008 at 11:32 AM, Anne Archibald > <[EMAIL PROTECTED]> wrote: > > > So ... fixing x[0][0] for matrices should wait > > > until 1.2. Is that correct? > > > > It seems to me that everyone agrees that the current situation is >

Re: [Numpy-discussion] numpy release

2008-04-23 Thread David Huard
2008/4/23, Stéfan van der Walt <[EMAIL PROTECTED]>: > > Hi Jarrod > > Of those tickets, the following are serious: > > http://projects.scipy.org/scipy/numpy/ticket/605 (a patch is > available?, David Huard) > Fixing of histogram. > I haven't found a way to fix histogram reliably without breaking

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

2008-04-23 Thread Christopher Barker
Christopher Barker wrote: > Thomas Hrabe wrote: > I'd poke around the wiki, and this mailing list archives, for more examples. This may help: http://scipy.org/Cookbook/C_Extensions -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-

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

2008-04-23 Thread Hoyt Koepke
Just to add something from personal experience in case it's useful... I write a lot of code that works on numpy arrays that goes between python and c++ (too used to OO to stick with pure c). I've been using scipy.weave to interface to blitz++ arrays in my c++ code. The blitz++ library has been wo

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

2008-04-23 Thread Christopher Barker
Andreas Klöckner wrote: > IMO, all of these deal better with C than they do with C++. True, though SWIG works OK with C++. > There is also a > number of more C++-affine solutions: > > - Boost Python [1]. Especially if you want usable C++ integration. (ie. more > than basic templates, etc.) W

Re: [Numpy-discussion] OSX installer: please test

2008-04-23 Thread Christopher Barker
Christopher Burns wrote: > I've built a Universal Mac binary for numpy 1.1.0. If > Mac people would kindly test it, I'd appreciate any feedback. > > > Download here: > https://cirl.berkeley.edu/numpy/numpy-1.1.0rc1-py2.5-macosx10.5.dmg Note that it's called *osx10.5.dmg, but it

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

2008-04-23 Thread Andreas Klöckner
On Mittwoch 23 April 2008, Christopher Barker wrote: > NOTE: > Most folks now think that the pain of writing extensions completely by > hand is not worth it -- it's just too easy to make reference counting > mistakes, etc. Most folks are now using one of: > > Cython (or Pyrex) > SWIG > ctypes IMO,

Re: [Numpy-discussion] OSX installer: please test

2008-04-23 Thread Robert Kern
On Wed, Apr 23, 2008 at 9:51 AM, Robert Pyle <[EMAIL PROTECTED]> wrote: > Here are some more complete tests on my assorted Macs. > > Note that on the dual G5 tower, /usr/local/lib/libgfortran.2.dylib > seems to be missing, under both Tiger (10.4.11) and Leopard (10.5.2). > However, under both op

[Numpy-discussion] "aligned" matrix / ctypes

2008-04-23 Thread Zachary Pincus
Hello all, I need to allocate a numpy array that I will then pass to a camera driver (via ctypes) so that the driver can fill the array with pixels. The catch is that the driver requires that rows of pixels start at 4- byte boundaries. The sample C++ code given for allocating memory for this

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Jarrod Millman
On Wed, Apr 23, 2008 at 11:32 AM, Anne Archibald <[EMAIL PROTECTED]> wrote: > > So ... fixing x[0][0] for matrices should wait > > until 1.2. Is that correct? > > It seems to me that everyone agrees that the current situation is > broken, but there is considerable disagreement on what the cor

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

2008-04-23 Thread Christopher Barker
Thomas Hrabe wrote: > One can find multiple approaches to arrays, the old numeric array and > the new ndarray. The new stuff seems to be backward compatible. mostly, yes. numpy (ndarray) is the only option going forward, as it's the only one being maintained. > However, where is a free documen

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Anne Archibald
On 23/04/2008, Alan Isaac <[EMAIL PROTECTED]> wrote: > On Wed, 23 Apr 2008, Sebastian Haase wrote: > > What used to be referred to a the 1.1 version, that can > > break more stuff, to allow for a cleaner design, will now > > be 1.2 > > So ... fixing x[0][0] for matrices should wait > until 1.2.

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Alan Isaac
On Wed, 23 Apr 2008, Sebastian Haase wrote: > What used to be referred to a the 1.1 version, that can > break more stuff, to allow for a cleaner design, will now > be 1.2 So ... fixing x[0][0] for matrices should wait until 1.2. Is that correct? Thank you, Alan Isaac _

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

2008-04-23 Thread Thomas Hrabe
Hi all, first of all, thank you for the rich spectrum of answers, especially to Joris' sample code. What I still do not understand is the following: One can find multiple approaches to arrays, the old numeric array and the new ndarray. The new stuff seems to be backward compatible. However, wh

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Stéfan van der Walt
Hi Jarrod Of those tickets, the following are serious: http://projects.scipy.org/scipy/numpy/ticket/605 (a patch is available?, David Huard) Fixing of histogram. http://projects.scipy.org/scipy/numpy/ticket/551 (old regression, Chuck and Travis) Unpickled arrays don't work as expected, becau

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Jarrod Millman
On Wed, Apr 23, 2008 at 6:21 AM, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > The question is: what blocks the release of 1.1? The following > tickets deserve attention: > > http://projects.scipy.org/scipy/numpy/ticket/750 > http://projects.scipy.org/scipy/numpy/ticket/605 > http://projec

Re: [Numpy-discussion] finding minimum distance using arrays

2008-04-23 Thread Christopher Barker
Nadav Horesh wrote: > def distance(v1,v2): >return sqrt(((v2-v1)**2).sum()) note that Roberts version didn't compute the sqrt, as to find the minimum distance, you can just used the squared value. If you do want the actual distance, then you might want to use numpy.hypot, something like (un

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

2008-04-23 Thread Joris De Ridder
On 23 Apr 2008, at 17:50, Tommy Grav wrote: > > On Apr 23, 2008, at 11:26 AM, Joris De Ridder wrote: > >> >> They are attached to the wiki page. Click on "Attachments" in the >> menu >> on the left. >> >> Joris > > Thanks. Didn't know that wiki's had that :) > > I tried you example on a Mac OS

Re: [Numpy-discussion] Warning: converting a masked element to nan

2008-04-23 Thread Pierre GM
On Wednesday 23 April 2008 04:00:13 Eric Firing wrote: > I think there is a bug in that method; it always returns a nan, > sometimes with the warning, and sometimes without. By analogy with the > ndarray method, it should raise an exception if the array has more than > one element, and it there is

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

2008-04-23 Thread Bill Spotz
On Apr 23, 2008, at 9:50 AM, Tommy Grav wrote: > > On Apr 23, 2008, at 11:26 AM, Joris De Ridder wrote: > >> >> They are attached to the wiki page. Click on "Attachments" in the >> menu >> on the left. >> >> Joris > > Thanks. Didn't know that wiki's had that :) > > I tried you example on a Mac OS

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

2008-04-23 Thread Tommy Grav
On Apr 23, 2008, at 11:26 AM, Joris De Ridder wrote: > > They are attached to the wiki page. Click on "Attachments" in the menu > on the left. > > Joris Thanks. Didn't know that wiki's had that :) I tried you example on a Mac OS X 10.5.2 (I am not using Scons) and got [skathi:~/Work/myCode/pyC

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Ondrej Certik
On Wed, Apr 23, 2008 at 4:56 PM, Sebastian Haase <[EMAIL PROTECTED]> wrote: > > On Wed, Apr 23, 2008 at 2:32 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > > On Mon, Apr 14, 2008 at 12:06 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > > > Hi Jarrod, > > > > > > any news with the 1.0.5? If y

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

2008-04-23 Thread Andreas Klöckner
On Mittwoch 23 April 2008, Albert Strasheim wrote: > Hello, > > On Tue, Apr 22, 2008 at 11:38 PM, Thomas Hrabe <[EMAIL PROTECTED]> wrote: > > I am currently developing a python module in C/C++ which is supposed to > > access nd arrays as defined by the following command in python > > You might als

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

2008-04-23 Thread Stéfan van der Walt
2008/4/23 Tommy Grav <[EMAIL PROTECTED]>: > > On Apr 22, 2008, at 9:56 PM, Joris De Ridder wrote: > > > > > On http://www.scipy.org/JorisDeRidder I've just put an example how I > > passed multidimensional Numpy arrays to C++ using ctypes. Perhaps > > it's helpful for your application. I didn't

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

2008-04-23 Thread Joris De Ridder
They are attached to the wiki page. Click on "Attachments" in the menu on the left. Joris On 23 Apr 2008, at 17:19, Tommy Grav wrote: > > On Apr 22, 2008, at 9:56 PM, Joris De Ridder wrote: > >> >> On http://www.scipy.org/JorisDeRidder I've just put an example how I >> passed multidimensiona

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

2008-04-23 Thread Tommy Grav
On Apr 22, 2008, at 9:56 PM, Joris De Ridder wrote: > > On http://www.scipy.org/JorisDeRidder I've just put an example how I > passed multidimensional Numpy arrays to C++ using ctypes. Perhaps > it's helpful for your application. I didn't put it in the cookbook > yet, because I would first

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Sebastian Haase
On Wed, Apr 23, 2008 at 2:32 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > On Mon, Apr 14, 2008 at 12:06 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > > Hi Jarrod, > > > > any news with the 1.0.5? If you have same prerelease, I'd like to test > > it. Debian has just moved from python2.4 to

Re: [Numpy-discussion] OSX installer: please test

2008-04-23 Thread Robert Pyle
Here are some more complete tests on my assorted Macs. Note that on the dual G5 tower, /usr/local/lib/libgfortran.2.dylib seems to be missing, under both Tiger (10.4.11) and Leopard (10.5.2). However, under both operating systems, /usr/local/gfortran/lib/ libgfortran.2.dylib exists, as does

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

2008-04-23 Thread Albert Strasheim
Hello, On Tue, Apr 22, 2008 at 11:38 PM, Thomas Hrabe <[EMAIL PROTECTED]> wrote: > I am currently developing a python module in C/C++ which is supposed to > access nd arrays as defined by the following command in python You might also be interested in: http://mathema.tician.de/software/pyublas

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Stéfan van der Walt
2008/4/23 Ondrej Certik <[EMAIL PROTECTED]>: > What is the plan with the release? There are some minor problems in > the Debian package, some of which are fixed by the new release. > I didn't fix those in Debian as I thought the new release is coming > out. But if it's going to take let's say m

[Numpy-discussion] About sse, automatic vectorization and deployment issues

2008-04-23 Thread David Cournapeau
Hi, I just came across a long thread on sse, automatic vectorization by gcc and deployment issues (linux specific, but still relevant for numpy I think). I thought it was interesting, and tackles most issues we would face once we go to that route: http://lalists.stanford.edu/lad/2008/04/00

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Ondrej Certik
On Mon, Apr 14, 2008 at 12:06 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > Hi Jarrod, > > any news with the 1.0.5? If you have same prerelease, I'd like to test > it. Debian has just moved from python2.4 to python2.5 yesterday, so > I'd like to test numpy in advance, I am sure there will be so

Re: [Numpy-discussion] f2py: optional parameters and present() bug?

2008-04-23 Thread Pearu Peterson
Garry Willgoose wrote: > in a F90 routine called from python the present() test (for optional > parameters) always returns true whether the parameter is present in > the function call or not. My F90 test code looks like this > > subroutine test(test1,test2,test3) >integer,intent(in) :: t

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

2008-04-23 Thread Joris De Ridder
Hi Sebastian, > this is a great ( short ) recipe ! Thanks! > Could you elaborate on the line > "You need to compile myextension.cpp and make a shared library from > it. The easiest way is to use Scons with the constructor file: !? David already gave the answer. Scons allows you to make shared

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

2008-04-23 Thread Matthieu Brucher
> > the compiler, the compiler flags, the linker, the linker flags, the > location of Python.h, etc... > > > > With a simple extension builder, we didn't encountered any bug > > although we have a fair number of extensions. > > > Building a helloworld like extension or say numpy.core is kind of the

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

2008-04-23 Thread David Cournapeau
Matthieu Brucher wrote: > > Having a good python extension builder is also more difficult than I > first expected, too (you can't retrieve options for MS compilers from > distutils, for example and I would like to support building with and > without distutils' help). > > > What are

Re: [Numpy-discussion] Warning: converting a masked element to nan

2008-04-23 Thread Pierre GM
On Wednesday 23 April 2008 04:00:13 Eric Firing wrote: > I think there is a bug in that method; it always returns a nan, > sometimes with the warning, and sometimes without. Well, the first time you get a warning, you don't the following times. > By analogy with the > ndarray method, it should

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

2008-04-23 Thread Matthieu Brucher
> > Having a good python extension builder is also more difficult than I > first expected, too (you can't retrieve options for MS compilers from > distutils, for example and I would like to support building with and > without distutils' help). What are these options that must be retrieved? With a

[Numpy-discussion] f2py: optional parameters and present() bug?

2008-04-23 Thread Garry Willgoose
in a F90 routine called from python the present() test (for optional parameters) always returns true whether the parameter is present in the function call or not. My F90 test code looks like this subroutine test(test1,test2,test3) integer,intent(in) :: test1 integer,intent(in),optional :

Re: [Numpy-discussion] Warning: converting a masked element to nan

2008-04-23 Thread Eric Firing
Vincent Schut wrote: > Hi, > > Using maskedarrays (from svn numpy trunk), I sometimes get this warning: > > "Warning: converting a masked element to nan". > > It is not entirely clear to me what it means, and why it happens. Does > it mean that numpy.ma is converting an element of the data part

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

2008-04-23 Thread David Cournapeau
Matthieu Brucher wrote: > Hi David ! > > Is it possible to construct a Python module with Scons without > tampering with different flags? I think you built your own builder > (just like I did), but did you manage to put it in Scons 0.98 ? Unfortunately, no. I had to make a choice on which featur

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

2008-04-23 Thread Matthieu Brucher
Hi David ! Is it possible to construct a Python module with Scons without tampering with different flags? I think you built your own builder (just like I did), but did you manage to put it in Scons 0.98 ? Matthieu 2008/4/23, David Cournapeau <[EMAIL PROTECTED]>: > > Sebastian Haase wrote: > > >

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

2008-04-23 Thread David Cournapeau
Sebastian Haase wrote: > > Hi Joris, > this is a great ( short ) recipe ! Could you elaborate on the line > "You need to compile myextension.cpp and make a shared library from > it. The easiest way is to use Scons with the constructor file:" > !? > How do you call Scons in your example !? On Window

Re: [Numpy-discussion] Warning: converting a masked element to nan

2008-04-23 Thread Pierre GM
Vincent, As a generic rule, this warning is output when the masked value (numpy.ma.masked) has to be converted to a float: in that case, a NaN is returned. Now, the exact reason why the masked value has to be converted is specific to your problem. A simple example of when this warning occurs wou

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

2008-04-23 Thread Sebastian Haase
On Wed, Apr 23, 2008 at 3:56 AM, Joris De Ridder <[EMAIL PROTECTED]> wrote: > > > On http://www.scipy.org/JorisDeRidder I've just put an example how I passed > multidimensional Numpy arrays to C++ using ctypes. Perhaps it's helpful for > your application. I didn't put it in the cookbook yet, becaus

Re: [Numpy-discussion] different behaviour in asfarray(None)

2008-04-23 Thread Stéfan van der Walt
2008/4/23 Travis E. Oliphant <[EMAIL PROTECTED]>: > I'm curious who made the change and why. There was code intentionally > there to interpret None as nan for float arrays. So, I don't > understand why and/or when it changed. I find that behaviour counterintuitive (I'm not the one who changed i

[Numpy-discussion] Warning: converting a masked element to nan

2008-04-23 Thread Vincent Schut
Hi, Using maskedarrays (from svn numpy trunk), I sometimes get this warning: "Warning: converting a masked element to nan". It is not entirely clear to me what it means, and why it happens. Does it mean that numpy.ma is converting an element of the data part of the MA to NaN, on it's own? If s