Fixed typo
This commit is contained in:
parent
82e79dda78
commit
56ee1156f0
5 changed files with 35 additions and 12 deletions
|
@ -11,22 +11,33 @@ __all__=["fast_interp"]
|
|||
|
||||
@cython.boundscheck(False)
|
||||
@cython.cdivision(True)
|
||||
def fast_interp(npx.float64_t xmin, npx.float64_t dx, npx.float64_t[:] A, npx.float64_t[:] y, npx.float64_t[:] out, npx.float64_t beyond_val=npx.nan):
|
||||
def fast_interp(xmin0, dx0, A0, y0, out0, beyond_val=np.nan):
|
||||
cdef double rq, q
|
||||
cdef int iq
|
||||
cdef long i, Asize, ysize
|
||||
cdef npx.float64_t[:] out0
|
||||
cdef npx.float64_t xmin, dx
|
||||
cdef npx.float64_t[:] out
|
||||
cdef npx.float64_t[:] A, y
|
||||
cdef npx.float64_t beyond
|
||||
|
||||
beyond=beyond_val
|
||||
xmin = xmin0
|
||||
dx = dx0
|
||||
A = A0
|
||||
y = y0
|
||||
ysize = y.size
|
||||
out0 = out
|
||||
out = out0
|
||||
Asize = A.size
|
||||
|
||||
if out.size != ysize:
|
||||
raise ValueError("out and y must have the same size")
|
||||
|
||||
with nogil:
|
||||
for i in prange(ysize):
|
||||
q = (y[i] - xmin) / dx
|
||||
iq = int(floor(q))
|
||||
rq = (q-iq)
|
||||
if iq+1 >= Asize or iq < 0:
|
||||
out0[i] = beyond_val
|
||||
out[i] = beyond
|
||||
else:
|
||||
out0[i] = rq * A[iq+1] + (1-rq)*A[iq]
|
||||
out[i] = rq * A[iq+1] + (1-rq)*A[iq]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue