# jedbrown/numpy-fortran forked from certik/numpy-fortran

Fetching contributors…
Cannot retrieve contributors at this time
74 lines (53 sloc) 1.1 KB
 NumPy Fortran ---- from numpy import array, size, min, max, sum a = array([1, 2, 3]) print size(a) print max(a) print min(a) print sum(a) real(dp) :: a(3) a = [1, 2, 3] print *, size(a) print *, maxval(a) print *, minval(a) print *, sum(a) ---- from numpy import array, size a = array([[1, 2, 3], [4, 5, 6]]) print size(a, 0) print size(a, 1) real(dp) :: a(2, 3) a = reshape([1, 2, 3, 4, 5, 6], [2, 3]) print *, size(a, 1) print *, size(a, 2) ---- from numpy import array, size, max, min a = array([[1, 2, 3], [4, 5, 6]]) print max(a) print min(a) real(dp) :: a(2, 3) a = reshape([1, 2, 3, 4, 5, 6], [2, 3]) print *, minval(a) print *, maxval(a) ---- where ( evalues < ef - fdtol*kbt) eweights = 1._dp elsewhere( evalues > ef + fdtol*kbt) eweights = 0._dp elsewhere eweights = 1._dp/(exp((evalues-ef)/kbt) + 1._dp) end where ---- idos = sum(matmul(eweights,kweights)) dot_product ---- logical arrays ---- from numpy import array, shape x = array([[1, 6], [2, 7], [3, 8], [4, 9], [5, 10]]) print shape(x) integer :: x(5, 2) x = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], shape(x)) print *, shape(x)