Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

74 lines (53 sloc) 1.125 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)
Jump to Line
Something went wrong with that request. Please try again.