def coeffmult(fc, gc):
"""Coefficient-Space multiplication of equal-length first-kind
Chebyshev series."""
Fc = np.append( 2.*fc[:1], (fc[1:], fc[:0:-1]) )
Gc = np.append( 2.*gc[:1], (gc[1:], gc[:0:-1]) )
ak = ifft( fft(Fc) * fft(Gc) )
ak = np.append( ak[:1], ak[1:] + ak[:0:-1] ) * .25
ak = ak[:fc.size]
inputcfs = np.append(fc, gc)
out = np.real(ak) if np.isreal(inputcfs).all() else ak
return out
评论列表
文章目录