diff options
author | wfspotz@sandia.gov <wfspotz@sandia.gov@localhost> | 2007-04-04 22:58:23 +0000 |
---|---|---|
committer | wfspotz@sandia.gov <wfspotz@sandia.gov@localhost> | 2007-04-04 22:58:23 +0000 |
commit | cca1f4916cfb74f913bd8b291d752c9e1567d1a7 (patch) | |
tree | eaa0dec5be52721bfbacc077a6302d2c557236a2 /numpy/doc/swig/numpy_swig.html | |
parent | 7fc01ddf963b3ba2baaa2a29cd25ec139d6f7319 (diff) | |
download | numpy-cca1f4916cfb74f913bd8b291d752c9e1567d1a7.tar.gz |
Updated documentation for 3D typemaps
Diffstat (limited to 'numpy/doc/swig/numpy_swig.html')
-rw-r--r-- | numpy/doc/swig/numpy_swig.html | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/numpy/doc/swig/numpy_swig.html b/numpy/doc/swig/numpy_swig.html index c975ce417..8f292d446 100644 --- a/numpy/doc/swig/numpy_swig.html +++ b/numpy/doc/swig/numpy_swig.html @@ -5,7 +5,7 @@ <meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> <title>numpy.i: a SWIG Interface File for NumPy</title> <meta name="author" content="Bill Spotz" /> -<meta name="date" content="3 April, 2007" /> +<meta name="date" content="4 April, 2007" /> <style type="text/css"> /* @@ -302,7 +302,7 @@ ul.auto-toc { <tr class="field"><th class="docinfo-name">Institution:</th><td class="field-body">Sandia National Laboratories</td> </tr> <tr><th class="docinfo-name">Date:</th> -<td>3 April, 2007</td></tr> +<td>4 April, 2007</td></tr> </tbody> </table> <div class="contents topic"> @@ -567,12 +567,15 @@ of array. The input array signatures are</p> <li><tt class="docutils literal"><span class="pre">(DATA_TYPE</span> <span class="pre">IN_ARRAY2[ANY][ANY])</span></tt></li> <li><tt class="docutils literal"><span class="pre">(DATA_TYPE*</span> <span class="pre">IN_ARRAY2,</span> <span class="pre">int</span> <span class="pre">DIM1,</span> <span class="pre">int</span> <span class="pre">DIM2)</span></tt></li> <li><tt class="docutils literal"><span class="pre">(int</span> <span class="pre">DIM1,</span> <span class="pre">int</span> <span class="pre">DIM2,</span> <span class="pre">DATA_TYPE*</span> <span class="pre">IN_ARRAY2)</span></tt></li> +<li><tt class="docutils literal"><span class="pre">(DATA_TYPE</span> <span class="pre">IN_ARRAY3[ANY][ANY][ANY])</span></tt></li> +<li><tt class="docutils literal"><span class="pre">(DATA_TYPE*</span> <span class="pre">IN_ARRAY3,</span> <span class="pre">int</span> <span class="pre">DIM1,</span> <span class="pre">int</span> <span class="pre">DIM2,</span> <span class="pre">int</span> <span class="pre">DIM3)</span></tt></li> +<li><tt class="docutils literal"><span class="pre">(int</span> <span class="pre">DIM1,</span> <span class="pre">int</span> <span class="pre">DIM2,</span> <span class="pre">int</span> <span class="pre">DIM3,</span> <span class="pre">DATA_TYPE*</span> <span class="pre">IN_ARRAY3)</span></tt></li> </ul> </blockquote> <p>The first signature listed, <tt class="docutils literal"><span class="pre">(DATA_TYPE</span> <span class="pre">IN_ARRAY[ANY])</span></tt> is for one-dimensional arrays with hard-coded dimensions. Likewise, <tt class="docutils literal"><span class="pre">(DATA_TYPE</span> <span class="pre">IN_ARRAY2[ANY][ANY])</span></tt> is for two-dimensional arrays with -hard-coded dimensions.</p> +hard-coded dimensions, and similarly for three-dimensional.</p> </div> <div class="section"> <h2><a class="toc-backref" href="#id5" id="in-place-arrays" name="in-place-arrays">In-Place Arrays</a></h2> @@ -589,6 +592,9 @@ signatures are</p> <li><tt class="docutils literal"><span class="pre">(DATA_TYPE</span> <span class="pre">INPLACE_ARRAY2[ANY][ANY])</span></tt></li> <li><tt class="docutils literal"><span class="pre">(DATA_TYPE*</span> <span class="pre">INPLACE_ARRAY2,</span> <span class="pre">int</span> <span class="pre">DIM1,</span> <span class="pre">int</span> <span class="pre">DIM2)</span></tt></li> <li><tt class="docutils literal"><span class="pre">(int</span> <span class="pre">DIM1,</span> <span class="pre">int</span> <span class="pre">DIM2,</span> <span class="pre">DATA_TYPE*</span> <span class="pre">INPLACE_ARRAY2)</span></tt></li> +<li><tt class="docutils literal"><span class="pre">(DATA_TYPE</span> <span class="pre">INPLACE_ARRAY3[ANY][ANY][ANY])</span></tt></li> +<li><tt class="docutils literal"><span class="pre">(DATA_TYPE*</span> <span class="pre">INPLACE_ARRAY3,</span> <span class="pre">int</span> <span class="pre">DIM1,</span> <span class="pre">int</span> <span class="pre">DIM2,</span> <span class="pre">int</span> <span class="pre">DIM3)</span></tt></li> +<li><tt class="docutils literal"><span class="pre">(int</span> <span class="pre">DIM1,</span> <span class="pre">int</span> <span class="pre">DIM2,</span> <span class="pre">int</span> <span class="pre">DIM3,</span> <span class="pre">DATA_TYPE*</span> <span class="pre">INPLACE_ARRAY3)</span></tt></li> </ul> </blockquote> <p>These typemaps now check to make sure that the <tt class="docutils literal"><span class="pre">INPLACE_ARRAY</span></tt> @@ -612,14 +618,15 @@ arrays in, they simply get returned. The argout signatures are</p> <li><tt class="docutils literal"><span class="pre">(DATA_TYPE*</span> <span class="pre">ARGOUT_ARRAY1,</span> <span class="pre">int</span> <span class="pre">DIM1)</span></tt></li> <li><tt class="docutils literal"><span class="pre">(int</span> <span class="pre">DIM1,</span> <span class="pre">DATA_TYPE*</span> <span class="pre">ARGOUT_ARRAY1)</span></tt></li> <li><tt class="docutils literal"><span class="pre">(DATA_TYPE</span> <span class="pre">ARGOUT_ARRAY2[ANY][ANY])</span></tt></li> +<li><tt class="docutils literal"><span class="pre">(DATA_TYPE</span> <span class="pre">ARGOUT_ARRAY3[ANY][ANY][ANY])</span></tt></li> </ul> </blockquote> <p>These are typically used in situations where in C/C++, you would allocate a(n) array(s) on the heap, and call the function to fill the array(s) values. In python, the arrays are allocated for you and returned as new array objects.</p> -<p>Note that we support <tt class="docutils literal"><span class="pre">DATA_TYPE*</span></tt> argout typemaps in 1D, but not -2D. This because of a quirk with the <a class="reference" href="http://www.swig.org">SWIG</a> typemap syntax and +<p>Note that we support <tt class="docutils literal"><span class="pre">DATA_TYPE*</span></tt> argout typemaps in 1D, but not 2D +or 3D. This because of a quirk with the <a class="reference" href="http://www.swig.org">SWIG</a> typemap syntax and cannot be avoided. Note that for these types of 1D typemaps, the python function will take a single argument representing <tt class="docutils literal"><span class="pre">DIM1</span></tt>.</p> </div> @@ -851,10 +858,10 @@ example):</p> </pre> </li> <li><p class="first">You can use the code in <tt class="docutils literal"><span class="pre">numpy.i</span></tt> to write your own typemaps. -For example, if you had a three-dimensional array as a function -argument, you could cut-and-paste the appropriate two-dimensional -typemap into your interface file. The modifications for the third -dimension would be trivial.</p> +For example, if you had a four-dimensional array as a function +argument, you could cut-and-paste the appropriate +three-dimensional typemaps into your interface file. The +modifications for the fourth dimension would be trivial.</p> </li> <li><p class="first">Sometimes, the best approach is to use the <tt class="docutils literal"><span class="pre">%extend</span></tt> directive to define new methods for your classes (or overload existing ones) @@ -899,9 +906,9 @@ between <a class="reference" href="http://numpy.scipy.org">NumPy</a> arrays and <tt class="docutils literal"><span class="pre">unsigned</span> <span class="pre">char</span></tt>, <tt class="docutils literal"><span class="pre">short</span></tt>, <tt class="docutils literal"><span class="pre">unsigned</span> <span class="pre">short</span></tt>, <tt class="docutils literal"><span class="pre">int</span></tt>, <tt class="docutils literal"><span class="pre">unsigned</span> <span class="pre">int</span></tt>, <tt class="docutils literal"><span class="pre">long</span></tt>, <tt class="docutils literal"><span class="pre">unsigned</span> <span class="pre">long</span></tt>, <tt class="docutils literal"><span class="pre">long</span> <span class="pre">long</span></tt>, <tt class="docutils literal"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">long</span></tt>, <tt class="docutils literal"><span class="pre">float</span></tt> and <tt class="docutils literal"><span class="pre">double</span></tt>.</li> -<li>That support 16 different argument signatures for each data type, +<li>That support 23 different argument signatures for each data type, including:<ul> -<li>One-dimensional and two-dimensional arrays.</li> +<li>One-dimensional, two-dimensional and three-dimensional arrays.</li> <li>Input-only, in-place, and argout behavior.</li> <li>Hard-coded dimensions, data-buffer-then-dimensions specification, and dimensions-then-data-buffer specification.</li> @@ -914,7 +921,7 @@ wrapper developers, including:</p> <blockquote> <ul class="simple"> <li>A <a class="reference" href="http://www.swig.org">SWIG</a> macro (<tt class="docutils literal"><span class="pre">%numpy_typemaps</span></tt>) with three arguments for -implementing the 16 argument signatures for the user's choice of +implementing the 23 argument signatures for the user's choice of (1) C data type, (2) <a class="reference" href="http://numpy.scipy.org">NumPy</a> data type (assuming they match), and (3) dimension type.</li> <li>Seven C macros and eleven C functions that can be used to write @@ -938,7 +945,7 @@ possible.</p> </div> <div class="footer"> <hr class="footer" /> -Generated on: 2007-04-04 16:10 UTC. +Generated on: 2007-04-04 22:57 UTC. Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> |