[SciPy-user] weave.inline : resize an array in c++

Samuel GARCIA sgarcia at olfac.univ-lyon1.fr
Fri Apr 14 04:18:06 CDT 2006


I also try :
from scipy import *
from scipy import weave
from scipy.weave import converters

c = ones((3,6))

code = """
  PyArray_Dims dims;
  dims.len = 2;
  dims.ptr = new int[2];
  dims.ptr[0] = 4;
  dims.ptr[1] = 7;
  PyArray_Resize(c_array,&dims);
"""
err = weave.inline(code,
    ['c'],
    type_converters=converters.blitz)
print c


but fails again

Any ideas ?

Sam



Samuel GARCIA a écrit :

> Other approch : Where can  I found good and easy examples for using 
> weave.inline()
>
> thanks
>
> samuel
>
> Samuel GARCIA a écrit :
>
>> Hi,
>> how to resize a array in the c++ code with weave.inline()
>>
>> I try :
>>
>> from scipy import *
>> from scipy import weave
>> from scipy.weave import converters
>>
>> c = ones((3,6))
>>
>> code = """
>>   PyArray_Dims dims;
>>   dims.len = 2;
>>   dims.ptr = new int[2];
>>   dims.ptr[0] = 4;
>>   dims.ptr[1] = 7;
>>   PyArray_Resize(&c,&dims);
>> """
>> err = weave.inline(code,
>>     ['c'],
>>     type_converters=converters.blitz)
>> print c.shape    #I want (4,7) !!!
>>
>> but it does'nt work because c is not a PyArray_Object.
>>
>> Is there a easier (and working) way ?
>>
>> Thanks
>>
>> Samuel
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>SciPy-user mailing list
>>SciPy-user at scipy.net
>>http://www.scipy.net/mailman/listinfo/scipy-user
>>  
>>
>------------------------------------------------------------------------
>
>_______________________________________________
>SciPy-user mailing list
>SciPy-user at scipy.net
>http://www.scipy.net/mailman/listinfo/scipy-user
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20060414/80b95831/attachment.htm


More information about the SciPy-user mailing list