def dweighted_wiener(x,k,s=1.,t=0.,shift=0.,scale=1.): from numpy import sqrt, array from spyctral.fourier.eval import fseries as genfourier from spyctral.fourier.eval import dfseries as dgenfourier from spyctral.wiener.maps import dtheta_dx from spyctral.wiener.maps import x_to_theta as x2theta from spyctral.wiener.weights import sqrt_weight_bias as wx_sqrt from spyctral.wiener.weights import dsqrt_weight_bias as dwx_sqrt # Preprocessing and setup x = array(x) x = x.ravel() k = array(k,dtype=int) k = k.ravel() theta = x2theta(x,shift=shift,scale=scale) # First term: wx_sqrt * d/dx Phi psi = (dtheta_dx(x,shift=shift,scale=scale)*dgenfourier(theta,k,s-1.,t).T).T psi = (wx_sqrt(x,s,t,shift=shift,scale=scale)*(psi.T)).T # Second term: d/dx wx_sqrt * Phi psi += (dwx_sqrt(x,s,t,shift=shift,scale=scale)*genfourier(theta,k,s-1.,t).T).T return psi/sqrt(scale)
def dwiener(x,k,s=1.,t=0.,shift=0.,scale=1.): from spyctral.fourier.eval import dfseries as dgenfourier from spyctral.wiener.maps import x_to_theta as x2theta from spyctral.wiener.maps import x_to_r as x2r from numpy import array # Preprocessing and setup x = array(x) x = x.ravel() k = array(k,dtype=int) k = k.ravel() theta = x2theta(x,shift=shift,scale=scale) r = x2r(x,shift=shift,scale=scale) return ((1+r)*(dgenfourier(theta,k,s-1.,t).T)).T/scale