2007/11/20, Georg Holzmann <[EMAIL PROTECTED]>: > > Hallo! > > > Really? I worked pretty hard to avoid copies when they were not > > necessary. For the ARGOUT typemaps, I allocate an array of the > > requested size and then pass its data buffer to your function. If > > Yes but this means that you again allocate an array of the same size.
Well, this is logical as you want a new argument in output. E.g. in my algorithm I can have a very big internal matrix in C++ (say > 700 MB - in fortran style). Now I want to have this matrix in numpy to > plot some parts of it, get some data out of it ... whatever - if I again > allocate an array of the same size, I am out of memory. > Therefore I simply used the PyArray_FromDimsAndData() function to > allocate the array. This is why you use INPLACE typemaps that will NOT copy your data. > that is not what you want, then you should probably be using the > > INPLACE typemap. > > Yeah, but this results in the same as above ... Are you sure ? Because the original object is not modified, so it is still the same data. If what you want is to provide a view from your C++ matrix, this is different. You must either : - propose the array interface - use a Python object inside your C++ matrix (this is to be done, I've a basic example in my blog) Matthieu -- French PhD student Website : http://miles.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion