[SciPy-user] Another weave question

Fernando Perez fperez at colorado.edu
Tue May 6 15:03:35 EDT 2003


eric jones wrote:
> The following works.  I also tried with the blitz converters, but got
> one of those confounding template tracbacks that it produces.
> Unfortunately, I don't have time to trace down that error right now. 

Well, funny that it works just fine for me.  After removing the py::float 
stuff as per your suggestion, I end up with:

def cross_productC(a,b):
     """Cross product of two 3-d vectors.
     """
     # py::Tuple or py::List work equally well in this case.
     code = \
"""
py::list cross(3);

cross[0] = a(1)*b(2)-a(2)*b(1);
cross[1] = a(2)*b(0)-a(0)*b(2);
cross[2] = a(0)*b(1)-a(1)*b(0);
return_val = cross;
"""
     return array(inline(code,['a','b'],
                         type_converters = converters.blitz))


This works perfectly for me.  If it's a weave regression, I can see when I 
last updated CVS for you to see what happened.

It turns out that, with all the changes you made recently to weave, it became 
a lot _easier_ to use than it used to be.  A lot of the old py::THIS/THAT 
boilerplate which used to be necessary is gone, which is great news.

It's just that my old code still had all that and I don't know enough about 
the details to know what must stay and what can go.

Weave is amazing.  It would be great if at some point in the future you guys 
can find the time to update the docs a bit, as I think documentation is its 
only weak spot.  In the meantime (I know you're busy), I'm including here my 
examples file for others to use.  It documents a bunch of usage cases in small 
snippets, making it easy to pick stuff from for real-life projects.

Best regards, and thanks again,

Fernando.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: weave_examples.py
Type: text/x-python
Size: 11590 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20030506/51f6fb2a/attachment.py>


More information about the SciPy-User mailing list