[SciPy-user] 2D arrays in weave.inline

william ratcliff william.ratcliff@gmail....
Sat Nov 17 16:16:55 CST 2007


Gael, have you tried weave with openmp?

Cheers,
William

On Nov 17, 2007 4:46 PM, Gael Varoquaux <gael.varoquaux@normalesup.org> wrote:
> On Sat, Nov 17, 2007 at 03:30:10PM -0600, Alan Jackson wrote:
> > This is probably an astonishingly simple question, but I've been
> > struggling for some time with it.
>
> > I am trying to work with weave for the first time, and it is becoming
> > clear that I don't understand how 2D arrays get passed.
>
> Me neither. This is why I use the blitz converter. I modified your
> example to use the vlitz converters, it is just so much nicer:
>
> ++++++++++++++++++++++++++++++++++++++++++++
> def Fast(s1, s2, wt1, wt2, M):
>
>     seq1 = s1[0]
>     seq2 = s2[0]
>     t1 = s1[1]
>     t2 = s2[1]
>
>     code = '''
>
>
>   for (int idx2 = 0; idx2 < 10; ++idx2) {
>     printf("\\n");
>     for (int idx1 = 0; idx1 < 10; ++idx1) {
>       printf("%6f  ", M(idx1, idx2));
>
>     }// for whole s1
>   }// for whole s2
>   printf("\\n");
>   '''
>
>     weave.inline(code, ["seq1", "seq2", "t1", "t2", "M" ],
>                         type_converters=converters.blitz,
>             )
> ++++++++++++++++++++++++++++++++++++++++++++
>
>
> > BTW the link to the weave documentation is a dead link. Is there any
> > documentation beyond a couple of short examples? Every promising google
> > link turns up dead.
>
> There have been a few threads on this mailing list. I also think
> http://scipy.org/PerformancePython#head-a3f4dd816378d3ba4cbdd3d23dc98529e8ad7087
> can be useful.
>
> Gaël
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-user mailing list