In [1]:
%load_ext fortranmagic
In [6]:
%%fortran
subroutine f1(n)
INTEGER j
INTEGER, DIMENSION(4,4) ::array
array = reshape((/ 9,9,6,-1,9,30,5,22,6,5,10,0,-1,22,0,36 /), shape(array))
DO 20 j = 1, n
print *, 'NEW J'
print *, array(1:, j)
print *, array(j+1:,j)
20 Continue
END
end
In [7]:
f1(4)
In [51]:
%%file test.py
import testf
testf.f1(2)
In [52]:
!python test.py
In [12]:
%%fortran
subroutine f1(x, y, z)
real, intent(in) :: x,y
real, intent(out) :: z
z = sin(x+y)
end subroutine f1
In [7]:
import numpy as np
x = np.array([1,2,3,4])
y = np.arange(4)
In [9]:
x * y
Out[9]:
In [10]:
x.dot(y)
Out[10]:
In [ ]: