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

Gael Varoquaux gael.varoquaux@normalesup....
Sat Nov 17 15:46:59 CST 2007

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) {
    for (int idx1 = 0; idx1 < 10; ++idx1) {
      printf("%6f  ", M(idx1, idx2));

    }// for whole s1
  }// for whole s2

    weave.inline(code, ["seq1", "seq2", "t1", "t2", "M" ],

> 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
can be useful.


More information about the SciPy-user mailing list