diff options
author | Pauli Virtanen <pav@iki.fi> | 2014-01-02 22:12:01 +0200 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2014-01-02 22:19:47 +0200 |
commit | 75c2d2fe3cc9daa6589707fb6b8512ffa48fc365 (patch) | |
tree | 32e729ca94dd28e06c7c2e10fd250f2ce4b91a2a /doc/f2py/ex1 | |
parent | a32807e61b25205cc08d552127234b56709c6242 (diff) | |
download | numpy-75c2d2fe3cc9daa6589707fb6b8512ffa48fc365.tar.gz |
DOC: move f2py documentation under doc/ and link its user guide with Sphinx
Diffstat (limited to 'doc/f2py/ex1')
-rw-r--r-- | doc/f2py/ex1/arr.f | 4 | ||||
-rw-r--r-- | doc/f2py/ex1/bar.f | 4 | ||||
-rw-r--r-- | doc/f2py/ex1/foo.f | 5 | ||||
-rw-r--r-- | doc/f2py/ex1/foobar-smart.f90 | 24 | ||||
-rw-r--r-- | doc/f2py/ex1/foobar.f90 | 16 | ||||
-rw-r--r-- | doc/f2py/ex1/foobarmodule.tex | 36 | ||||
-rwxr-xr-x | doc/f2py/ex1/runme | 18 |
7 files changed, 107 insertions, 0 deletions
diff --git a/doc/f2py/ex1/arr.f b/doc/f2py/ex1/arr.f new file mode 100644 index 000000000..c4e49988f --- /dev/null +++ b/doc/f2py/ex1/arr.f @@ -0,0 +1,4 @@ + subroutine arr(l,m,n,a) + integer l,m,n + real*8 a(l,m,n) + end diff --git a/doc/f2py/ex1/bar.f b/doc/f2py/ex1/bar.f new file mode 100644 index 000000000..c723b5af1 --- /dev/null +++ b/doc/f2py/ex1/bar.f @@ -0,0 +1,4 @@ + function bar(a,b) + integer a,b,bar + bar = a + b + end diff --git a/doc/f2py/ex1/foo.f b/doc/f2py/ex1/foo.f new file mode 100644 index 000000000..cdcac4103 --- /dev/null +++ b/doc/f2py/ex1/foo.f @@ -0,0 +1,5 @@ + subroutine foo(a) + integer a +cf2py intent(in,out) :: a + a = a + 5 + end diff --git a/doc/f2py/ex1/foobar-smart.f90 b/doc/f2py/ex1/foobar-smart.f90 new file mode 100644 index 000000000..61385a685 --- /dev/null +++ b/doc/f2py/ex1/foobar-smart.f90 @@ -0,0 +1,24 @@ +!%f90 +module foobar ! in + note(This module contains two examples that are used in & + \texttt{f2py} documentation.) foobar + interface ! in :foobar + subroutine foo(a) ! in :foobar:foo.f + note(Example of a wrapper function of a Fortran subroutine.) foo + integer intent(inout),& + note(5 is added to the variable {{}\verb@a@{}} ``in place''.) :: a + end subroutine foo + function bar(a,b) result (ab) ! in :foobar:bar.f + integer :: a + integer :: b + integer :: ab + note(The first value.) a + note(The second value.) b + note(Add two values.) bar + note(The result.) ab + end function bar + end interface +end module foobar + +! This file was auto-generated with f2py (version:0.95). +! See http://cens.ioc.ee/projects/f2py2e/ diff --git a/doc/f2py/ex1/foobar.f90 b/doc/f2py/ex1/foobar.f90 new file mode 100644 index 000000000..53ac5b506 --- /dev/null +++ b/doc/f2py/ex1/foobar.f90 @@ -0,0 +1,16 @@ +!%f90 +module foobar ! in + interface ! in :foobar + subroutine foo(a) ! in :foobar:foo.f + integer intent(inout) :: a + end subroutine foo + function bar(a,b) ! in :foobar:bar.f + integer :: a + integer :: b + integer :: bar + end function bar + end interface +end module foobar + +! This file was auto-generated with f2py (version:0.95). +! See http://cens.ioc.ee/projects/f2py2e/ diff --git a/doc/f2py/ex1/foobarmodule.tex b/doc/f2py/ex1/foobarmodule.tex new file mode 100644 index 000000000..32411ec03 --- /dev/null +++ b/doc/f2py/ex1/foobarmodule.tex @@ -0,0 +1,36 @@ +% This file is auto-generated with f2py (version:2.266) +\section{Module \texttt{foobar}} + +This module contains two examples that are used in \texttt{f2py} documentation. + +\subsection{Wrapper function \texttt{foo}} + + +\noindent{{}\verb@foo@{}}\texttt{(a)} +--- Example of a wrapper function of a Fortran subroutine. + +\noindent Required arguments: +\begin{description} +\item[]{{}\verb@a : in/output rank-0 array(int,'i')@{}} +--- 5 is added to the variable {{}\verb@a@{}} ``in place''. +\end{description} + +\subsection{Wrapper function \texttt{bar}} + + +\noindent{{}\verb@bar = bar@{}}\texttt{(a, b)} +--- Add two values. + +\noindent Required arguments: +\begin{description} +\item[]{{}\verb@a : input int@{}} +--- The first value. +\item[]{{}\verb@b : input int@{}} +--- The second value. +\end{description} +\noindent Return objects: +\begin{description} +\item[]{{}\verb@bar : int@{}} +--- See elsewhere. +\end{description} + diff --git a/doc/f2py/ex1/runme b/doc/f2py/ex1/runme new file mode 100755 index 000000000..2aac6158e --- /dev/null +++ b/doc/f2py/ex1/runme @@ -0,0 +1,18 @@ +#!/bin/sh + +f2py2e='python ../../f2py2e.py' +PYINC=`$f2py2e -pyinc` +$f2py2e foobar-smart.pyf --short-latex --overwrite-makefile -makefile foo.f bar.f +gmake -f Makefile-foobar +#gcc -O3 -I$PYINC -I$PYINC/Numeric -shared -o foobarmodule.so foobarmodule.c foo.f bar.f +python -c ' +import foobar +print foobar.__doc__ +print foobar.bar(2,3) +from Numeric import * +a=array(3) +print a,foobar.foo(a),a +print foobar.foo.__doc__ +print foobar.bar.__doc__ +print "ok" +' |