In [1]:
import sys
sys.path.insert(0,"/home/fux/configs/jupyter/lib/python3.6/site-packages")
import fortranmagic

In [3]:
%load_ext fortranmagic


/home/fux/configs/jupyter/lib/python3.6/site-packages/fortranmagic.py:147: UserWarning: get_ipython_cache_dir has moved to the IPython.paths module since IPython 4.0.
  self._lib_dir = os.path.join(get_ipython_cache_dir(), 'fortran')

In [10]:
%%fortran
subroutine sumfor(x,y)
real, dimension(:), intent(in) ::x
real, intent(out)::y
y = sum(x)
end subroutine

In [11]:
from numpy import *
sumfor(arange(1,10))


Out[11]:
45.0

In [18]:
%timeit sumfor(arange(1,10^6))


The slowest run took 21.87 times longer than the fastest. This could mean that an intermediate result is being cached.
1000000 loops, best of 3: 928 ns per loop

In [21]:
%timeit sum(arange(1,10^6))


The slowest run took 11.19 times longer than the fastest. This could mean that an intermediate result is being cached.
100000 loops, best of 3: 3.73 µs per loop

In [22]:
%%fortran --link lapack -vv


UsageError: %%fortran is a cell magic, but the cell body is empty.

In [ ]: