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

2009-03-03 Thread David Warde-Farley
On 4-Mar-09, at 1:50 AM, Hoyt Koepke wrote: > I would definitely encourage you to check out cython. I have to write > lots of numerically intensive stuff in my python code, and I tend to > cythonize it a lot. Seconded. I recently took some distance computation code and Cythonized it, I got an

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

2009-03-03 Thread David Warde-Farley
On 4-Mar-09, at 1:58 AM, Robert Kern wrote: > I'm pretty sure that's exactly why he did it, and that's what he's > calling evil. As ever, such nuance is lost on me. I didn't bother to check whether or not it was in the original function. Robert to the rescue. :) It's a neat trick, actually,

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

2009-03-03 Thread Robert Kern
On Wed, Mar 4, 2009 at 00:56, David Warde-Farley wrote: > On 3-Mar-09, at 11:41 PM, Jonathan Taylor wrote: > >> def rotation(theta, R = np.zeros((3,3))): > > Hey Jon, > > Just a note, in case you haven't heard this schpiel before: be careful > when you use mutables as default arguments. It can lea

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

2009-03-03 Thread David Warde-Farley
On 3-Mar-09, at 11:41 PM, Jonathan Taylor wrote: > def rotation(theta, R = np.zeros((3,3))): Hey Jon, Just a note, in case you haven't heard this schpiel before: be careful when you use mutables as default arguments. It can lead to unexpected behaviour down the line. The reason is that the

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

2009-03-03 Thread Hoyt Koepke
Hello, > def rotation(theta, R = np.zeros((3,3))): >cx,cy,cz = np.cos(theta) >sx,sy,sz = np.sin(theta) >R.flat = (cx*cz - sx*cy*sz, cx*sz + sx*cy*cz, sx*sy, >-sx*cz - cx*cy*sz, -sx*sz + cx*cy*cz, >cx*sy, sy*sz, -sy*cz, cy) >return R > > Pretty evil looking ;) but st

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

2009-03-03 Thread Hoyt Koepke
> def rotation(theta, R = np.zeros((3,3))): >cx,cy,cz = np.cos(theta) >sx,sy,sz = np.sin(theta) >R.flat = (cx*cz - sx*cy*sz, cx*sz + sx*cy*cz, sx*sy, >-sx*cz - cx*cy*sz, -sx*sz + cx*cy*cz, >cx*sy, sy*sz, -sy*cz, cy) >return R > > Pretty evil looking ;) but still woul

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

2009-03-03 Thread Chris Colbert
since you only need to calculate the sine or cosine of a single value (not an array of values) I would recommend using the sine and cosine function of the python standard math library as it is a full order of magnitude faster. (at least on my core 2 windows vista box) i.e. import math as m m.sin

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

2009-03-03 Thread josef . pktd
On Tue, Mar 3, 2009 at 11:41 PM, Jonathan Taylor wrote: > Thanks,  All these things make sense and I should have known to > calculate the sins and cosines up front.  I managed a few more > "tricks" and knocked off 40% of the computation time: > > def rotation(theta, R = np.zeros((3,3))): >    cx,c

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

2009-03-03 Thread Robert Kern
On Tue, Mar 3, 2009 at 22:41, Jonathan Taylor wrote: > Thanks,  All these things make sense and I should have known to > calculate the sins and cosines up front.  I managed a few more > "tricks" and knocked off 40% of the computation time: > > def rotation(theta, R = np.zeros((3,3))): >    cx,cy,c

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

2009-03-03 Thread Jonathan Taylor
Thanks, All these things make sense and I should have known to calculate the sins and cosines up front. I managed a few more "tricks" and knocked off 40% of the computation time: def rotation(theta, R = np.zeros((3,3))): cx,cy,cz = np.cos(theta) sx,sy,sz = np.sin(theta) R.flat = (cx*

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

2009-03-03 Thread Warren Focke
M *= N[:, newaxis] On Tue, 3 Mar 2009, Jose Borreguero wrote: > I guess there has to be an easy way for this. I have: > M.shape=(1,3) > N.shape=(1,) > > I want to do this: > for i in range(1): > M[i]*=N[i] > without the explicit loop > > > -Jose > _

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

2009-03-03 Thread josef . pktd
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,) > > I want to do this: > for i in range(1): > M[i]*=N[i] > without the explicit loop > >>> M = np.ones((10,3)) >>> N = np.arange(10) >>> N.shap

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

2009-03-03 Thread Jose Borreguero
I guess there has to be an easy way for this. I have: M.shape=(1,3) N.shape=(1,) I want to do this: for i in range(1): M[i]*=N[i] without the explicit loop -Jose ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.s

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2009-03-03 Thread Robert Kern
On Tue, Mar 3, 2009 at 03:11, Stéfan van der Walt wrote: > Hi Robert > > 2009/2/27 Robert Kern : >>> a[ix_([2,3,6],range(a.shape[1]),[3,2])] >>> >>> If anyone knows a better way? >> >> One could probably make ix_() take slice objects, too, to generate the >> correct arange() in the appropriate pla

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

2009-03-03 Thread Chris Colbert
sorry, i meant you're making 12 calls, not 16... Chris On Tue, Mar 3, 2009 at 8:14 PM, Chris Colbert wrote: > In addition to what Robert said, you also only need to calculate six > transcendentals: > > cx = cos(tx) > sx = sin(tx) > cy = cos(ty) > sy = sin(ty) > cz = cos(tz) > sz = sin(tz) > > y

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

2009-03-03 Thread Chris Colbert
In addition to what Robert said, you also only need to calculate six transcendentals: cx = cos(tx) sx = sin(tx) cy = cos(ty) sy = sin(ty) cz = cos(tz) sz = sin(tz) you, are making sixteen transcendental calls in your loop each time. I can also recommend Chapter 2 of Introduction to Robotics: Mec

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

2009-03-03 Thread Robert Kern
On Tue, Mar 3, 2009 at 17:53, 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

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

2009-03-03 Thread Jonathan Taylor
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 rotation matrix corresponding to this vector

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

2009-03-03 Thread Jonathan Taylor
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 rotation matrix corresponding to this vector so it is getting constructed once for each iteration with new values. >From profiling I can Hi,

Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-03 Thread Neil Crighton
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's a bit more straightforward

Re: [Numpy-discussion] [Fwd: Issue 113 in sphinx: nodes.py KeyError "entries" in numpy doc build]

2009-03-03 Thread Pauli Virtanen
Tue, 03 Mar 2009 11:15:31 -1000, Eric Firing wrote: > I have been trying to build numpy docs from the svn doc subdirectory, > and I have been notifying the sphinx people when things don't work. They > have made several fixes, but here is one that will require a change on > the numpy side. I know

[Numpy-discussion] [Fwd: Issue 113 in sphinx: nodes.py KeyError "entries" in numpy doc build]

2009-03-03 Thread Eric Firing
I have been trying to build numpy docs from the svn doc subdirectory, and I have been notifying the sphinx people when things don't work. They have made several fixes, but here is one that will require a change on the numpy side. I know zip about sphinx extensions, so I don't expect to be able

Re: [Numpy-discussion] SVN and Trac servers are back up

2009-03-03 Thread Stéfan van der Walt
2009/3/3 Stéfan van der Walt : > 2009/3/3 Peter Wang : >> Can you try again?  I looked again and it looks like there are >> definitely some files that were not writeable by the Apache server. > > I think it is the notification system that is failing to send out > e-mails.  I'll look into it. Shoul

Re: [Numpy-discussion] Proposed schedule for numpy 1.3.0

2009-03-03 Thread Peter Wang
On Mar 3, 2009, at 1:52 PM, Pierre GM wrote: > David, >> I also started to update the release notes: >> >> http://projects.scipy.org/scipy/numpy/browser/trunk/doc/release/1.3.0-notes.rst > > I get a 404. This is most likely a DNS issue. Please try pinging projects.scipy.org from the command li

Re: [Numpy-discussion] Proposed schedule for numpy 1.3.0

2009-03-03 Thread David Cournapeau
On Wed, Mar 4, 2009 at 4:52 AM, Pierre GM wrote: > David, >> I also started to update the release notes: >> >> http://projects.scipy.org/scipy/numpy/browser/trunk/doc/release/1.3.0-notes.rst > > I get a 404. Yes, sorry about that, the server migration has caused some changes here. I will wait for

Re: [Numpy-discussion] SVN and Trac servers are back up

2009-03-03 Thread Stéfan van der Walt
2009/3/3 Peter Wang : > Can you try again?  I looked again and it looks like there are > definitely some files that were not writeable by the Apache server. I think it is the notification system that is failing to send out e-mails. I'll look into it. Cheers Stéfan ___

Re: [Numpy-discussion] Proposed schedule for numpy 1.3.0

2009-03-03 Thread Christopher Hanley
Pierre GM wrote: > David, >> I also started to update the release notes: >> >> http://projects.scipy.org/scipy/numpy/browser/trunk/doc/release/1.3.0-notes.rst > > I get a 404. > > Anyhow, on the ma side: > * structured arrays should now be fully supported by MaskedArray >(r6463, r6324, r6305,

Re: [Numpy-discussion] Proposed schedule for numpy 1.3.0

2009-03-03 Thread Pierre GM
David, > I also started to update the release notes: > > http://projects.scipy.org/scipy/numpy/browser/trunk/doc/release/1.3.0-notes.rst I get a 404. Anyhow, on the ma side: * structured arrays should now be fully supported by MaskedArray (r6463, r6324, r6305, r6300, r6294...) * Minor bug fixe

Re: [Numpy-discussion] SVN and Trac servers are back up

2009-03-03 Thread Peter Wang
On Mar 3, 2009, at 1:02 PM, David Cournapeau wrote: > It looks like modifying tickets still cause some trouble: after > clicking > "submit changes", the server seems to hang, and the request never > ends, > > Thanks again for all your work on the migration, > David Can you try again? I looke

Re: [Numpy-discussion] numpy and python 2.6 on windows: please test

2009-03-03 Thread James Watson
>> Windows debug extensions have a suffix, d. If you don't install the >> debug version of numpy, you can't use it with debug Python. *red face* forgot about --debug... > Yes, this has actually nothing to do with python 2.6. I noticed the > crash, thought naively it would be easy to fix, but

Re: [Numpy-discussion] SVN and Trac servers are back up

2009-03-03 Thread David Cournapeau
Hi Peter, Peter Wang wrote: > Hi everyone, > > We have moved the scipy and numpy Trac and SVN servers to a new > machine. We have also moved the scikits SVN repository, but not its > Trac (scipy.org/scipy/scikits). The SVN repositories for wavelets, > mpi4py, and other projects that are ho

[Numpy-discussion] SVN and Trac servers are back up

2009-03-03 Thread Peter Wang
Hi everyone, We have moved the scipy and numpy Trac and SVN servers to a new machine. We have also moved the scikits SVN repository, but not its Trac (scipy.org/scipy/scikits). The SVN repositories for wavelets, mpi4py, and other projects that are hosted on scipy have not been moved yet,

Re: [Numpy-discussion] Help on subclassing numpy.ma: __array_wrap__

2009-03-03 Thread Pierre GM
Kevin, Sorry for the delayed answer. > > (a) Is MA intended to be subclassed? Yes, that's actually the reason why the class was rewritten, to simplify subclassing. As Josef suggested, you can check the scikits.timeseries package that makes an extensive use of MaskedArray as baseclass. > >

[Numpy-discussion] Proposed schedule for numpy 1.3.0

2009-03-03 Thread David Cournapeau
Hi, A few weeks ago, we had a discussion about the 1.3.0 release schedule, but we did not end up stating a schedule. I stand up to be the release manager for 1.3.0, and suggest the following: Beta: 15th March (only doc + severe regressions accepted after, branch trunk into 1.3.x, trunk opened

Re: [Numpy-discussion] 64-bit numpy questions?

2009-03-03 Thread Travis E. Oliphant
Todd Miller wrote: > Hi, > > I've been looking at a 64-bit numpy problem we were having on Solaris: > > >>> a=numpy.zeros(0x18000,dtype='b1') > >>> a.data > Traceback (most recent call last): > File "", line 1, in > ValueError: size must be zero or positive > > A working fix seemed to be thi

Re: [Numpy-discussion] 64-bit numpy questions?

2009-03-03 Thread Hanni Ali
> > Is anyone using numpy in 64-bit environments on a day-to-day basis? Windows 2003 64 >Are you using very large arrays, i.e. over 2G in size? Yes without any problems, using Python 2.6. Hanni ___ Numpy-discussion mailing list Numpy-discussio

Re: [Numpy-discussion] 64-bit numpy questions?

2009-03-03 Thread Robin
On Tue, Mar 3, 2009 at 4:20 PM, Todd Miller wrote: > Is anyone using numpy in 64-bit > environments on a day-to-day basis? Yes - linux x86_64 > Are you using very large arrays, > i.e.  over 2G in size? I have been using arrays this size and larger (mainly sparse matrices) without any problem (e

Re: [Numpy-discussion] 64-bit numpy questions?

2009-03-03 Thread Gael Varoquaux
On Tue, Mar 03, 2009 at 11:20:19AM -0500, Todd Miller wrote: > Is anyone using numpy in 64-bitenvironments on a day-to-day basis? I am. > Are you using very large arrays, i.e. over 2G in size? I believe so, but I may be wrong. Gaël ___ Numpy-discussi

[Numpy-discussion] 64-bit numpy questions?

2009-03-03 Thread Todd Miller
Hi, I've been looking at a 64-bit numpy problem we were having on Solaris: >>> a=numpy.zeros(0x18000,dtype='b1') >>> a.data Traceback (most recent call last): File "", line 1, in ValueError: size must be zero or positive A working fix seemed to be this: Index: arrayobject.c =

[Numpy-discussion] SVN and TRAC migrations starting NOW

2009-03-03 Thread David Cournapeau
Dear Numpy and Scipy developers, We are now starting the svn and trac migrations to new servers: - The svn repositories of both numpy and scipy are now unavailable, and should be available around 16:00 UTC (3rd March 2009). You will then be able to update/commit again. - Trac for numpy

Re: [Numpy-discussion] numpy and python 2.6 on windows: please test

2009-03-03 Thread James Watson
> Windows debug extensions have a suffix, d. If you don't install the > debug version of numpy, you can't use it with debug Python. Ah, thank you. Sorry for the newb question: how do you install the debug version (for msvc)? ___ Numpy-discussion mailing

Re: [Numpy-discussion] RFR: fix signed/unsigned comparison warnings in numpy

2009-03-03 Thread Stéfan van der Walt
2009/3/3 David Cournapeau : > David Cournapeau wrote: >> Hi, >> >>     A small patch to fix some last warnings (numpy almost builds warning >> free with -W -Wall -Wextra now). I am not sure about those >> (signed/unsigned casts are potentially dangerous), so I did not apply >> them directly. It did

Re: [Numpy-discussion] numpy and python 2.6 on windows: please test

2009-03-03 Thread Matthieu Brucher
2009/3/3 James Watson : >> I would appreciate if people would test building numpy >> (trunk); in particular since some issues are moderately complex and >> system dependent > > On Vista with VS2008, numpy rev r6535, I get the following behaviour: > 1. Building and installing numpy on python 2.6.1 c

Re: [Numpy-discussion] numpy and python 2.6 on windows: please test

2009-03-03 Thread David Cournapeau
Hi James, James Watson wrote: >> I would appreciate if people would test building numpy >> (trunk); in particular since some issues are moderately complex and >> system dependent >> > > On Vista with VS2008, numpy rev r6535, I get the following behaviour: > 1. Building and installing numpy on

Re: [Numpy-discussion] numpy and python 2.6 on windows: please test

2009-03-03 Thread James Watson
> I would appreciate if people would test building numpy > (trunk); in particular since some issues are moderately complex and > system dependent On Vista with VS2008, numpy rev r6535, I get the following behaviour: 1. Building and installing numpy on python 2.6.1 compiled in debug mode succeeds,

Re: [Numpy-discussion] RFR: fix signed/unsigned comparison warnings in numpy

2009-03-03 Thread David Cournapeau
David Cournapeau wrote: > Hi, > > A small patch to fix some last warnings (numpy almost builds warning > free with -W -Wall -Wextra now). I am not sure about those > (signed/unsigned casts are potentially dangerous), so I did not apply > them directly. It did help me discovering a bug or two in

[Numpy-discussion] RFR: fix signed/unsigned comparison warnings in numpy

2009-03-03 Thread David Cournapeau
Hi, A small patch to fix some last warnings (numpy almost builds warning free with -W -Wall -Wextra now). I am not sure about those (signed/unsigned casts are potentially dangerous), so I did not apply them directly. It did help me discovering a bug or two in numpy (fixed in the trunk): http:

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2009-03-03 Thread Stéfan van der Walt
Hi Robert 2009/2/27 Robert Kern : >> a[ix_([2,3,6],range(a.shape[1]),[3,2])] >> >> If anyone knows a better way? > > One could probably make ix_() take slice objects, too, to generate the > correct arange() in the appropriate place. I was wondering how one would implement this, since the ix_ func