from gwp2d import solver import numpy as np n = 256 nangles = 16 alpha = 1 beta = 3 ep = 1e-2 cl = solver.Solver(n, nangles, alpha, beta, ep) f = np.random.random([n, n]).astype('float32') coeffs = cl.fwd(f) fr = cl.adj(coeffs) s0 = np.sum(f*np.conj(fr)) s1 = np.float32(0) for k in range(len(coeffs)): s1 += np.sum(coeffs[k]*np.conj(coeffs[k])) print('Adjoint test <fwd(f),fwd(f)> ?= <f,adj(fwd(f))> :', s0, '?=', s1)
from gwp2d import solver import numpy as np import dxchange n = 512 nangles = 14 alpha = 1 beta = 3 ep = 1e-2 levels = [0, 1, 1, 2, 2, 2] angs = [2, 3, 12, 7, 8, 0] # init coefficients cl = solver.Solver(n, nangles, alpha, beta, ep, [0, 1, 2]) f = np.random.random([n, n]).astype('float32') coeffs = cl.fwd(f) # zero coefficients and set only the one as 1 for k in range(len(coeffs)): coeffs[k][:] = 0 for j in range(len(levels)): level = levels[j] ang = angs[j] cshape = np.array(coeffs[level][0].shape) ind = cshape // 2 #+np.int32((np.random.random(2)-0.5)*cshape*0.25) coeffs[level][ang, ind[0], ind[1]] = 1 # recover gwp fr = cl.adj(coeffs) # check coefficients