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