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

David Warde-Farley dwf@cs.toronto....
Wed Mar 4 01:28:11 CST 2009

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, though I'll probably shoot myself in the  
foot if I try to use it. I've taken to the somewhat unpythonic  
convention of passing in "out" arrays everywhere to avoid repeated  
allocations, i.e.

def foo(x, y, out=None):
	if out == None:
		out = np.empty(...)

It's a neat trick, the default argument one, but I'd probably shoot  
myself in the foot with it. Also, I guess it only works when the  
dimensions are fixed (like in this case).


More information about the Numpy-discussion mailing list