2018-10-03 18:59:01 +00:00
|
|
|
# from: http://stackoverflow.com/questions/17112550/python-and-numba-for-vectorized-functions # noqa
|
|
|
|
# setup: import numpy as np ; N = 100000 ; a, b, c = np.random.rand(N), np.random.rand(N), np.random.rand(N) # noqa
|
|
|
|
# run: vibr_energy(a, b, c)
|
2018-04-05 22:07:33 +00:00
|
|
|
|
2018-10-03 18:59:01 +00:00
|
|
|
# pythran export vibr_energy(float64[], float64[], float64[])
|
2018-04-05 22:07:33 +00:00
|
|
|
import numpy
|
2018-10-03 12:38:48 +00:00
|
|
|
|
|
|
|
|
2018-04-05 22:07:33 +00:00
|
|
|
def vibr_energy(harmonic, anharmonic, i):
|
|
|
|
return numpy.exp(-harmonic * i - anharmonic * (i ** 2))
|