def dweighted_fseries(theta,ks,gamma=0.,delta=0.,shift=0.,scale=1.): from numpy import sqrt from weights import sqrt_weight_bias as wsqrt_bias from weights import dsqrt_weight_bias as dwsqrt_bias w = wsqrt_bias(theta,gamma=gamma,delta=delta,scale=scale,shift=shift) dw = dwsqrt_bias(theta,gamma=gamma,delta=delta,scale=scale,shift=shift) Psi = fseries(theta,ks,gamma=gamma,delta=delta,scale=scale,shift=shift) dPsi = dfseries(theta,ks,gamma=gamma,delta=delta,scale=scale,shift=shift) # yay product rule return (dw*Psi.T + w*dPsi.T).T/sqrt(scale)
def weighted_fseries(theta,k,gamma=0.,delta=0.,shift=0.,scale=1.): from spyctral.common.maps import standard_scaleshift as sss from spyctral.common.maps import physical_scaleshift as pss from numpy import sqrt, array from weights import sqrt_weight_bias as wsqrt_bias theta = array(theta) theta = theta.ravel() sss(theta,shift=shift,scale=scale) psi = fseries(theta,k,gamma=gamma,delta=delta,shift=0.,scale=1.) phi = (wsqrt_bias(theta,gamma=gamma,delta=delta,shift=0.,scale=1.)*psi.T).T pss(theta,shift=shift,scale=scale) # Scaling: return phi/sqrt(scale)