[SciPy-user] weave and access to Numeric arrays

Fernando Perez fperez at pizero.colorado.edu
Mon Jul 22 17:08:31 CDT 2002

Hi folks,

I have a weave question. Is it possible to access the data for a 1-d Numeric 
array as a raw C array through weave? Up to now I've successfully used the 
blitz type converters, but I'm writing a sparse matrix algorithm where I want 
to do the pointer arithmetic by hand, as it's very straightforward and I need 
the thing to run really fast.

So if say A=Numeric.array([1,4.5,3.6]), is there a way in inlined weave code 
to do something like

for(i=0;i<N;++i) {
  sum += *(A_data+i);

for some way of having A_data be the pointer to the 'real' data in the Numeric 
array A?



More information about the SciPy-user mailing list