subroutine multiply(a,b,n,c) double precision, intent(in) :: a(n), b(n) integer, intent(in) :: n double precision, intent(out) :: c(n) integer :: i do i=1,n c(i)=a(i)*b(i) end do end subroutine multiply
import numpy as np ; import my_f90mod a = np.arange(10,dtype=np.float64) ; a /= len(a) b = np.arange(10,dtype=np.float64) ; b /= len(b) ; b = -b + 1. c = my_f90mod.multiply(a,b) print a ; print b ; print c
The computation of the velocity autocorrelation function is really slow in Python. \begin{equation*} < {\bf v}(\tau) \cdot {\bf v} > = \int_0^\infty {\bf v}(t+\tau) \cdot {\bf v}(t) \end{equation*}
Some results for the speed test.