grh.mur.at - SWIG http://grh.mur.at/taxonomy/term/47/0 en numpy2carray http://grh.mur.at/software/numpy2carray.html <div class="field field-type-text field-field-description"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Short Description:&nbsp;</div> <p>a python/numpy to C array converter for SWIG</p> </div> </div> </div> <div class="field field-type-number-integer field-field-year"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Started in:&nbsp;</div> 2007 </div> </div> </div> <div class="field field-type-text field-field-authors"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Authors:&nbsp;</div> Georg Holzmann </div> </div> </div> <div class="field field-type-text field-field-license"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> License:&nbsp;</div> BSD License </div> </div> </div> <div class="field field-type-text field-field-progamming-lang"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Programming language:&nbsp;</div> C, SWIG, Python </div> </div> </div> <div class="field field-type-text field-field-abstract"> <div class="field-label">Overview:&nbsp;</div> <div class="field-items"> <div class="field-item odd"> <p><strong><br /> NOTE:<br /> These wrappers are deprecated! They are now integrated in the official numpy swig interface file (numpy.i).<br /> You can find them in <a href="http://svn.scipy.org/svn/numpy/trunk/doc/swig/">numpy-svn/numpy/doc/swig</a>, also with quite good documentation!<br /> </strong></p> <p>This is an interface between <a href="http://numpy.scipy.org/">numpy</a> arrays (used for scientific computation in python - see <a href="http://www.scipy.org">scipy.org</a>) and C/C++ style arrays, build after looking at the umfpack.i interface from scipy.<br /> There exists also an other wrapper in scipy - however, you always have to copy data with those bindings which was not possible in my situation.</p> <p>All you need is the "numpy2carray.i" file.<br /> There are routines for array in/output with or without copying data (also for fortran style arrays - only one example in numpy2carray.i - see FARRAY2_OUT macro).</p> <p><strong>examples</strong></p> <p>class_example:</p> <p>A example usage with a class and some internal data.<br /> class_example.h: the C++ code<br /> class_example.i: the SWIG interface file<br /> class_example_usage.py: example usage in python</p> <p>example:</p> <p>A procedural example.<br /> example.cpp: the C++ code<br /> example.i: the SWIG interface file</p> <p>Building the examples:<br /> you need scons, the simply type "scons" in the terminal</p> <p>This code should be seen as a demonstration and should be customized to your application (e.g. maybe more error checking etc).</p> <p>See also the following links:<br /> <a href="http://www.geocities.com/foetsch/python/extending_python.htm">tutorial to start</a><br /> <a href="http://numpy.scipy.org/numpydoc/numpy-13.html">numpy C api</a><br /> <a href="http://www.swig.org/Doc1.3/Python.html">swig and python</a><br /> <a href="http://www.scipy.org/Cookbook/SWIG_and_NumPy">swig and numpy</a></p> </div> </div> </div> <div class="field field-type-filefield field-field-tarball"> <div class="field-label">Release Tarball:&nbsp;</div> <div class="field-items"> <div class="field-item odd"> <div class="filefield-file clear-block"><div class="filefield-icon field-icon-application-octet-stream"><img class="field-icon-application-octet-stream" alt="application/octet-stream icon" src="http://grh.mur.at/sites/all/modules/filefield/icons/protocons/16x16/mimetypes/application-octet-stream.png" /></div><a href="http://grh.mur.at/sites/default/files/numpy2carray.tar_.gz" type="application/octet-stream; length=4025" title="numpy2carray.tar_.gz">numpy2carray source and examples</a></div> </div> </div> </div> numpy python SWIG Wed, 24 Jun 2009 15:38:31 +0000 grh 142 at http://grh.mur.at