![](https://secure.gravatar.com/avatar/2cb42e5058af97d955e18572177981cf.jpg?s=120&d=mm&r=g)
No I can't it resize from python because it is to slow. There are a lot of iteration and for some of them I add a new value to a vector. My code was only an example, of course. Is it easier to add one element to a 1D array than a ND ? I am porting a old code from matlab and I was able to to do that in mex file with mxRealloc. thanks Sam Prabhu Ramachandran a écrit :
"Samuel" == Samuel GARCIA <sgarcia@olfac.univ-lyon1.fr> writes:
Samuel> Hi, how to resize a array in the c++ code with Samuel> weave.inline() [...] Samuel> c = ones((3,6)) [...] Samuel> err = weave.inline(code, ['c'], type_converters=converters.blitz) Samuel> print c.shape #I want (4,7) !!!
I am not sure why you'd want to do that. Can't you resize it from Python? In any case, if you really must do it, take a look at the c++ code generated by weave and look at it. You'll see that c_array is a PyArrayObject that you can use if you want it. However, I am not sure what will happen if you do resize the array and are using blitz. I suspect something bad may happen. Resizing the array might also relocate the entire block of memory for the array so accessing the older pointer will likely be disastrous. So, you should be careful doing this.
cheers, prabhu
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user