def scale_nodes(L,N,delta=0.5,s=1.,t=0.): from spyctral.wiener.quad import gq from spyctral.common.scaling import scale_factor [x,w] = gq(N,s=s,t=t) return scale_factor(L,x,delta=delta)
def fft_collocation_overhead(N,s=1.,t=0.,shift=0.,scale=1.): from numpy import sqrt from spyctral.fourier.fft import fft_overhead from spyctral.wiener.weights import sqrt_weight_bias as wx_sqrt from spyctral.wiener.quad import gq overhead = fft_overhead(N,gamma=s-1.,delta=t) x = gq(N,s=1.,t=0.,shift=shift,scale=scale)[0] premult = sqrt(scale)/wx_sqrt(x,s=s,t=t,shift=shift,scale=scale) return [premult,overhead]
def fft_collocation(f,s=1.,t=0.,shift=0.,scale=1.): from spyctral.fourier.fft import fft as fft_Psi from spyctral.wiener.weights import sqrt_weight_bias as wx_sqrt from spyctral.wiener.quad import gq from numpy import sqrt # This stuff can all be overhead N = f.size x = gq(N,s=1.,t=0.,shift=shift,scale=scale)[0] modes = f/wx_sqrt(x,s=s,t=t,shift=shift,scale=scale) temp = fft_Psi(modes,gamma=s-1.,delta=t)*float(sqrt(scale)) temp[-s:] = 0 temp[:s] = 0 return temp
def ifft_collocation(F,s=1.,t=0.,shift=0.,scale=1.): from spyctral.fourier.fft import ifft as ifft_Psi from spyctral.wiener.weights import sqrt_weight_bias as wx_sqrt from spyctral.wiener.quad import gq from numpy import sqrt from spyctral.fourier.fft import fft_overhead, ifft_online N = F.size #overhead = fft_overhead(N,g=s-1.,d=t) #fx = ifft_online(f,overhead) fx = ifft_Psi(F,gamma=s-1.,delta=t) x = gq(N,s=1.,t=0.,shift=shift,scale=scale)[0] fx *= wx_sqrt(x,s=s,t=t,shift=shift,scale=scale)/float(sqrt(scale)) #print "hi" return fx