def dct(a, b, type=2, axis=0, overwrite_input=False, threads=1, planner_effort="FFTW_EXHAUSTIVE"):
global dct_object
key = (a.shape, a.dtype, overwrite_input, axis, type)
if not key in dct_object:
if iscomplexobj(a):
ac = a.real.copy()
else:
ac = a
dct_object[key] = pyfftw.builders.dct(ac, axis=axis, type=type,
overwrite_input=overwrite_input,
threads=threads,
planner_effort=planner_effort)
dobj = dct_object[key]
c = dobj.get_output_array()
if iscomplexobj(a):
dobj(a.real, c)
b.real[:] = c
dobj(a.imag, c)
b.imag[:] = c
else:
dobj(a)
b[:] = c
return b
评论列表
文章目录