Re: [Numpy-discussion] Cython numerical syntax revisited

2009-03-04 Thread Dag Sverre Seljebotn
Andrew Straw wrote: > Dag Sverre Seljebotn wrote: >> This is NOT yet discussed on the Cython list; I wanted to check with >> more numerical users to see if the issue should even be brought up there. >> >> The idea behind the current syntax was to keep things as close as >> possible to Python/NumP

Re: [Numpy-discussion] Cython numerical syntax revisited

2009-03-04 Thread Dag Sverre Seljebotn
Sturla Molden wrote: >> arr = np.zeros(..) >> cdef int[:,:] buf = arr # 2D buffer >> >> Here, buf would be something else than arr; it is a seperate view to the >> array for low-level purposes. > > I like your proposal. The reason we use Fortran for numerical computing is > that Fortran makes it e

Re: [Numpy-discussion] Cython numerical syntax revisited

2009-03-04 Thread Dag Sverre Seljebotn
Stéfan van der Walt wrote: > Hi Dag > > 2009/3/5 Dag Sverre Seljebotn : >> More details: http://wiki.cython.org/enhancements/buffersyntax > > Interesting proposal! Am I correct in thinking that you'd have to > re-implement a lot of NumPy yourself to get this working? Or are you > planning to bu

Re: [Numpy-discussion] calling _import_array() twice crashes python

2009-03-04 Thread Lisandro Dalcin
In general, using complex extension modules like numpy between matching pairs of Py_Initialize()/Py_Finalize() is tricky... Extension modules have to be VERY carefully written as to permit such usage pattern... It is too easy to forget the init/cleanup/finalize steps... I was able to manage this i

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Robert Kern
On Thu, Mar 5, 2009 at 00:28, Charles R Harris wrote: > Heh, it's somehow comforting to know Matlab finds it a bit confusing too. I > suppose what bothers me is that fmax/fmin return the first argument when > both are nans. For reals, that is simply a nan, no problem, but for complex > numbers is

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Charles R Harris
On Wed, Mar 4, 2009 at 10:45 PM, David Cournapeau < da...@ar.media.kyoto-u.ac.jp> wrote: > Robert Kern wrote: > > On Wed, Mar 4, 2009 at 23:32, Charles R Harris > > wrote: > > > > > >> One thing that still bothers me a bit is the return value of fmax/fmin > when > >> comparing two complex nan val

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread David Cournapeau
Robert Kern wrote: > On Wed, Mar 4, 2009 at 23:32, Charles R Harris > wrote: > > >> One thing that still bothers me a bit is the return value of fmax/fmin when >> comparing two complex nan values. A complex number is a nan whenever the >> real or imaginary part is nan, and currently the functio

Re: [Numpy-discussion] A module for homogeneous transformation matrices, Euler angles and quaternions

2009-03-04 Thread Stéfan van der Walt
Hi Gareth 2009/3/5 Gareth Elston : > I seem to remember that there was a first draft of a guide for > developers being written. Are there any links available? Sorry, I should have posted that already. We are still setting up Trac to support a proper work-flow, which should be done soon. In the

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread David Cournapeau
Robert Kern wrote: > On Wed, Mar 4, 2009 at 23:32, Charles R Harris > wrote: > > >> One thing that still bothers me a bit is the return value of fmax/fmin when >> comparing two complex nan values. A complex number is a nan whenever the >> real or imaginary part is nan, and currently the functio

Re: [Numpy-discussion] Cython numerical syntax revisited

2009-03-04 Thread Stéfan van der Walt
Hi Dag 2009/3/5 Dag Sverre Seljebotn : > More details: http://wiki.cython.org/enhancements/buffersyntax Interesting proposal! Am I correct in thinking that you'd have to re-implement a lot of NumPy yourself to get this working? Or are you planning to build on NumPy + C-API? Cheers Stéfan _

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread David Cournapeau
Charles R Harris wrote: > > > On Wed, Mar 4, 2009 at 9:09 PM, David Cournapeau > mailto:da...@ar.media.kyoto-u.ac.jp>> > wrote: > > Charles R Harris wrote: > > > > > > On Wed, Mar 4, 2009 at 1:57 PM, Pauli Virtanen > >

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Robert Kern
On Wed, Mar 4, 2009 at 23:32, Charles R Harris wrote: > One thing that still bothers me a bit is the return value of fmax/fmin when > comparing two complex nan values. A complex number is a nan whenever the > real or imaginary part is nan, and currently the functions return such a > number but or

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Charles R Harris
On Wed, Mar 4, 2009 at 9:09 PM, David Cournapeau < da...@ar.media.kyoto-u.ac.jp> wrote: > Charles R Harris wrote: > > > > > > On Wed, Mar 4, 2009 at 1:57 PM, Pauli Virtanen > > wrote: > > > > Wed, 04 Mar 2009 13:18:55 -0700, Charles R Harris wrote: > > [clip] > > >

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread David Cournapeau
Charles R Harris wrote: > > > On Wed, Mar 4, 2009 at 1:57 PM, Pauli Virtanen > wrote: > > Wed, 04 Mar 2009 13:18:55 -0700, Charles R Harris wrote: > [clip] > > There are python max/min and their behaviour depends on the > scalar type. > > I haven't looked at

Re: [Numpy-discussion] A module for homogeneous transformation matrices, Euler angles and quaternions

2009-03-04 Thread Jonathan Taylor
Looks cool but a lot of this should be done in an extension module to make it fast. Perhaps starting this process off as a separate entity until stability is acheived. I would be tempted to do some of this using cython. I just wrote found that generating a rotation matrix from euler angles is ab

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-04 Thread Hoyt Koepke
You can get even more of a speed up with a couple tricks, though they might not be noticeable. The following is my modified version of your code: import numpy as np cimport cython from numpy cimport ndarray, empty cdef extern from "math.h": double cos(double) double sin(double) def rotati

Re: [Numpy-discussion] Example code for Numpy C preprocessor 'repeat' directive?

2009-03-04 Thread Charles R Harris
On Wed, Mar 4, 2009 at 5:54 PM, Stephen Simmons wrote: > Hi, > > Please can someone suggest resources for learning how to use the > 'repeat' macros in numpy C code to avoid repeating sections of > type-specific code for each data type? Ideally there would be two types > of resources: (i) a descrip

[Numpy-discussion] Example code for Numpy C preprocessor 'repeat' directive?

2009-03-04 Thread Stephen Simmons
Hi, Please can someone suggest resources for learning how to use the 'repeat' macros in numpy C code to avoid repeating sections of type-specific code for each data type? Ideally there would be two types of resources: (i) a description of how the repeat macros are meant to be used/compiled; an

Re: [Numpy-discussion] Cython numerical syntax revisited

2009-03-04 Thread Sturla Molden
> arr = np.zeros(..) > cdef int[:,:] buf = arr # 2D buffer > > Here, buf would be something else than arr; it is a seperate view to the > array for low-level purposes. I like your proposal. The reason we use Fortran for numerical computing is that Fortran makes it easy to manipulate arrays. C or

Re: [Numpy-discussion] Cython numerical syntax revisited

2009-03-04 Thread Andrew Straw
Dag Sverre Seljebotn wrote: > This is NOT yet discussed on the Cython list; I wanted to check with > more numerical users to see if the issue should even be brought up there. > > The idea behind the current syntax was to keep things as close as > possible to Python/NumPy, and only provide some "

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-04 Thread Jonathan Taylor
Just for other peoples reference I eventually went with a cython version that goes about twice as fast as my old post. Here it is: import numpy as np cimport numpy as np cdef extern from "math.h": double cos(double) double sin(double) def rotation(np.ndarray[double] theta): cdef np.

[Numpy-discussion] Cython numerical syntax revisited

2009-03-04 Thread Dag Sverre Seljebotn
This is NOT yet discussed on the Cython list; I wanted to check with more numerical users to see if the issue should even be brought up there. The idea behind the current syntax was to keep things as close as possible to Python/NumPy, and only provide some "hints" to Cython for optimization. My

[Numpy-discussion] A module for homogeneous transformation matrices, Euler angles and quaternions

2009-03-04 Thread Gareth Elston
I found a nice module for these transforms at http://www.lfd.uci.edu/~gohlke/code/transformations.py.html . I've been using an older version for some time and thought it might make a good addition to numpy/scipy. I made some simple mods to the older version to add a couple of functions I needed and

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Charles R Harris
On Wed, Mar 4, 2009 at 1:57 PM, Pauli Virtanen wrote: > Wed, 04 Mar 2009 13:18:55 -0700, Charles R Harris wrote: > [clip] > > There are python max/min and their behaviour depends on the scalar type. > > I haven't looked at the numpy scalars to see precisely what they do. > > > > Numpy max/min are

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Pauli Virtanen
Wed, 04 Mar 2009 13:18:55 -0700, Charles R Harris wrote: [clip] > There are python max/min and their behaviour depends on the scalar type. > I haven't looked at the numpy scalars to see precisely what they do. > > Numpy max/min are aliases for amax/amin defined when the core is > imported. The fun

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Charles R Harris
On Wed, Mar 4, 2009 at 1:37 PM, Stéfan van der Walt wrote: > 2009/3/4 Charles R Harris : > > It isn't clear to me that trac is mailing out the ticket reponses, so I'm > > posting to the list. > > It should work now. > I think it was sending mail to an old address. I've re-updated my account and h

Re: [Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Stéfan van der Walt
2009/3/4 Charles R Harris : > It isn't clear to me that trac is mailing out the ticket reponses, so I'm > posting to the list. It should work now. Cheers Stéfan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailm

[Numpy-discussion] Apropos ticked #913

2009-03-04 Thread Charles R Harris
Hi David, It isn't clear to me that trac is mailing out the ticket reponses, so I'm posting to the list. > #913: max is bogus if nan is in the array > +--- > Reporter: cdavid |Owner: somebody > Type: defect

Re: [Numpy-discussion] how to multiply the rows of a matrix by a different number?

2009-03-04 Thread Jose Borreguero
Sweet! I found that *M*b.reshape(1,1)* will also do the trick. Any guess which method is faster? On Tue, Mar 3, 2009 at 9:11 PM, wrote: > On Tue, Mar 3, 2009 at 8:53 PM, Jose Borreguero > wrote: > > I guess there has to be an easy way for this. I have: > > M.shape=(1,3) > > N.shape=(1

Re: [Numpy-discussion] NumPy SVN?

2009-03-04 Thread David Cournapeau
On Thu, Mar 5, 2009 at 1:33 AM, Bruce Southey wrote: > David Cournapeau wrote: >> On Thu, Mar 5, 2009 at 12:06 AM, Scott Sinclair >> wrote: >> >> >>> I had to do a fresh checkout from http://svn.scipy.org/svn/numpy/ >>> (note changed URL). >>> >> >> I did not know we could access svn from scipy.o

Re: [Numpy-discussion] NumPy SVN?

2009-03-04 Thread Bruce Southey
David Cournapeau wrote: > On Thu, Mar 5, 2009 at 12:06 AM, Scott Sinclair > wrote: > > >> I had to do a fresh checkout from http://svn.scipy.org/svn/numpy/ >> (note changed URL). >> > > I did not know we could access svn from scipy.org. I have alway used > svn.scipy.org - in which case you

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-04 Thread Lou Pecora
Whoops. I see you have profiled your code. Sorry to re-suggest that. But I agree with those who suggest a C speed up using ctypes or cthyon. However, thanks for posting your question. It caused a LOT of very useful responses that I didn't know about. Thanks to all who replied. -- Lou Peco

Re: [Numpy-discussion] NumPy SVN?

2009-03-04 Thread David Cournapeau
On Thu, Mar 5, 2009 at 12:06 AM, Scott Sinclair wrote: > I had to do a fresh checkout from http://svn.scipy.org/svn/numpy/ > (note changed URL). I did not know we could access svn from scipy.org. I have alway used svn.scipy.org - in which case you don't need to do anything to go to the new repo.

Re: [Numpy-discussion] NumPy SVN?

2009-03-04 Thread Scott Sinclair
> 2009/3/4 David Cournapeau : > Travis E. Oliphant wrote: >> Is commit to NumPy SVN still turned off?   How do I get a working SVN >> again? > > It is on - I could commit a few things 1-2 hours ago. If you still get > an administrative error message ("repo is read only ..."), it means you > are on

Re: [Numpy-discussion] NumPy SVN?

2009-03-04 Thread Peter Wang
On Mar 4, 2009, at 8:37 AM, David Cournapeau wrote: > Travis E. Oliphant wrote: >> Is commit to NumPy SVN still turned off? How do I get a working SVN >> again? >> > > It is on - I could commit a few things 1-2 hours ago. If you still get > an administrative error message ("repo is read only ...

Re: [Numpy-discussion] NumPy SVN?

2009-03-04 Thread David Cournapeau
Travis E. Oliphant wrote: > Is commit to NumPy SVN still turned off? How do I get a working SVN > again? > It is on - I could commit a few things 1-2 hours ago. If you still get an administrative error message ("repo is read only ..."), it means you are on the old repo. cheers, David _

[Numpy-discussion] NumPy SVN?

2009-03-04 Thread Travis E. Oliphant
Is commit to NumPy SVN still turned off? How do I get a working SVN again? -Travis ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] calling _import_array() twice crashes python

2009-03-04 Thread Soeren Sonnenburg
Dear all, I've written a wrapper enabling to run python code from within octave (and vice versa). To this end I am embedding python in octave. So I am calling Py_Initialize(); _import_array(); Py_Finalize(); multiple times. While things work nicely on the first run, I am getting a crash on _imp

[Numpy-discussion] ANN: python for scientific computing at SIAM CSE 09

2009-03-04 Thread Fernando Perez
Hi all, sorry for the spam, but in case any of you are coming to the SIAM Conference on Computational Science and Engineering (CSE09) in Miami: http://www.siam.org/meetings/cse09/ you might be interested in stopping by the Python sessions on Thursday: http://meetings.siam.org/sess/dsp_programse

[Numpy-discussion] Why using cblas in umath_test ?

2009-03-04 Thread David Cournapeau
Hi, I re-enabled umath tests (to test generalized ufuncs), to fix remaining issues, but I think there is something fundamentally wrong with it: it assumes cblas is available, which is not true. It happens to work on (some) Linux and mac os X only because those platforms provide cblas and blas

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-04 Thread Lou Pecora
First, do a profile. That will tell you how much time you are spending in each function and where the bottlenecks are. Easy to do in iPython. Second, (I am guessing here -- the profile will tell you) that the bottleneck is the "call back" to the rotation matrix function from the optimizer. T

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-04 Thread Sturla Molden
On 3/4/2009 7:50 AM, Hoyt Koepke wrote: > In cython, the above would be (something like): It also helps to turn off bounds checks: from numpy cimport ndarray cdef extern from "math.h": double cos(double) double sin(double) @cython.boundscheck(False) cpdef ndarray[double, n

Re: [Numpy-discussion] loadtxt issues

2009-03-04 Thread Sturla Molden
On 3/4/2009 12:57 PM, Sturla Molden wrote: > Does this work for you? Never mind, it seems my e-mail got messed up. I ought to keep them sorted by date... S.M. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mail

Re: [Numpy-discussion] loadtxt issues

2009-03-04 Thread Sturla Molden
On 2/11/2009 6:40 AM, A B wrote: > Hi, > > How do I write a loadtxt command to read in the following file and > store each data point as the appropriate data type: > > 12|h|34.5|44.5 > 14552|bbb|34.5|42.5 > dt = {'names': ('gender','age','weight','bal'), 'formats': ('i4', > 'S4','f4', 'f4')} Do

Re: [Numpy-discussion] PyArray_SETITEM with object arrays in Cython

2009-03-04 Thread Dag Sverre Seljebotn
Wes McKinney wrote: > This still doesn't explain why the buffer interface was slow. I finally remembered to look at this; there seems to be a problem in your code: > def reindexObject(ndarray[object, ndim=1] index, > ndarray[object, ndim=1] arr, > dict idxMap):

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-04 Thread Charles R Harris
On Wed, Mar 4, 2009 at 1:27 AM, Robert Cimrman wrote: > Jonathan Taylor wrote: > > Sorry.. obviously having some copy and paste trouble here. The > > message should be as follows: > > > > Hi, > > > > I am doing optimization on a vector of rotation angles tx,ty and tz > > using scipy.optimize.fmi

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-04 Thread Robert Cimrman
Jonathan Taylor wrote: > Sorry.. obviously having some copy and paste trouble here. The > message should be as follows: > > Hi, > > I am doing optimization on a vector of rotation angles tx,ty and tz > using scipy.optimize.fmin. Unfortunately the function that I am > optimizing needs the rotati

Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-04 Thread Robert Cimrman
Robert Cimrman wrote: > Neil Crighton wrote: >> Robert Kern gmail.com> writes: >> >>> Do you mind if we just add you to the THANKS.txt file, and consider >>> you as a "NumPy Developer" per the LICENSE.txt as having released that >>> code under the numpy license? If we're dotting our i's and crossi

Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-04 Thread Robert Cimrman
Neil Crighton wrote: > Robert Kern gmail.com> writes: > >> Do you mind if we just add you to the THANKS.txt file, and consider >> you as a "NumPy Developer" per the LICENSE.txt as having released that >> code under the numpy license? If we're dotting our i's and crossing >> our t's legally, that'