File size: 2,199 Bytes
c011401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
!%f90 -*- f90 -*-

!  Example:
!    Using f2py for wrapping multi-dimensional Fortran and C arrays
!    [NEW APPROACH, use it with f2py higher than 2.8.x]
!  $Id: fun.pyf,v 1.3 2002/01/18 10:06:50 pearu Exp $

! Usage (with gcc compiler):
!   f2py -c fun.pyf foo.f bar.c

python module fun ! in 
    interface  ! in :fun

! >>> from Numeric import *
! >>> import fun
! >>> a=array([[1,2,3],[4,5,6]])

        subroutine foo(a,m,n) ! in :fun:foo.f
          integer dimension(m,n) :: a
          intent(in,out,copy) :: a
          integer optional,check(shape(a,0)==m),depend(a) :: m=shape(a,0)
          integer optional,check(shape(a,1)==n),depend(a) :: n=shape(a,1)
        end subroutine foo

! >>> print fun.foo.__doc__
! foo - Function signature:
!   a = foo(a,[m,n])
! Required arguments:
!   a : input rank-2 array('i') with bounds (m,n)
! Optional arguments:
!   m := shape(a,0) input int
!   n := shape(a,1) input int
! Return objects:
!   a : rank-2 array('i') with bounds (m,n)

! >>> print fun.foo(a)
!  F77:
!  m= 2, n= 3
!  Row  1:
!  a(i= 1,j= 1) =  1
!  a(i= 1,j= 2) =  2
!  a(i= 1,j= 3) =  3
!  Row  2:
!  a(i= 2,j= 1) =  4
!  a(i= 2,j= 2) =  5
!  a(i= 2,j= 3) =  6
! [[77777     2     3]
!  [    4     5     6]]


        subroutine bar(a,m,n)
          intent(c)
          intent(c) bar
          integer dimension(m,n) :: a
          intent(in,out) :: a
          integer optional,check(shape(a,0)==m),depend(a) :: m=shape(a,0)
          integer optional,check(shape(a,1)==n),depend(a) :: n=shape(a,1)
          intent(in) m,n
        end subroutine bar

! >>> print fun.bar.__doc__
! bar - Function signature:
!   a = bar(a,[m,n])
! Required arguments:
!   a : input rank-2 array('i') with bounds (m,n)
! Optional arguments:
!   m := shape(a,0) input int
!   n := shape(a,1) input int
! Return objects:
!   a : rank-2 array('i') with bounds (m,n)

! >>> print fun.bar(a)
! C:m=2, n=3
! Row 1:
! a(i=0,j=0)=1
! a(i=0,j=1)=2
! a(i=0,j=2)=3
! Row 2:
! a(i=1,j=0)=4
! a(i=1,j=1)=5
! a(i=1,j=2)=6
! [[7777    2    3]
!  [   4    5    6]]

    end interface 
end python module fun

! This file was auto-generated with f2py (version:2.9.166).
! See http://cens.ioc.ee/projects/f2py2e/