def init_problem(prox_fns, implem, scale, try_split, merge, absorb): """ Initializes a problem. :param prox_fns: Proxable functions which define the problem. :type prox_fns: List :param implem: Implementation modus ("halide" or "numpy") :type implem: String :param scale: If the problem should be scaled :type scale: Bool :param try_split: If a problem split should be tried :type try_split: Bool :param merge: If problem should be merged :type merge: Bool :param absorb: If linear operators should be absorbed :type absorb: Bool :returns: Initialized problem :rtype: proximal.Problem """ prob = px.Problem(prox_fns, implem=Impl[implem], scale=scale, try_split=try_split, merge=merge, absorb=absorb) return prob
# Create ODL operator for the Laplacian laplacian = odl.Laplacian(space) # Create right hand side phantom = odl.phantom.shepp_logan(space, modified=True) phantom.show('original image') rhs = laplacian(phantom) rhs += odl.phantom.white_noise(space) * np.std(rhs) * 0.1 rhs.show('rhs') # Convert laplacian to ProxImaL operator proximal_lang_laplacian = odl.as_proximal_lang_operator(laplacian) # Convert to array rhs_arr = rhs.asarray() # Set up optimization problem x = proximal.Variable(space.shape) funcs = [ 10 * proximal.sum_squares(proximal_lang_laplacian(x) - rhs_arr), proximal.norm1(proximal.grad(x)) ] # Solve the problem using ProxImaL prob = proximal.Problem(funcs) prob.solve(verbose=True) # Convert back to odl and display result result_odl = space.element(x.value) result_odl.show('result from ProxImaL')