subroutine subs(a, b, n)
double precision a(n)
double precision b(n)
integer n
cf2py intent(in) :: a
cf2py intent(out) :: b
cf2py intent(hide) :: n
! b(1) = a(1)
do 100 i=2, n
b(i) = a(i)-1
100 continue
end
save it as aravir.py and do the following command
$ f2py -c aravir.f -m aravir
To use the module on the python I use the code below
import numpy as np
import aravir as ar
a = np.linspace(0,1,100)
b = ar.subs(a)
print a
print b
:)
No comments:
Post a Comment