Commit b3fd9e53 authored by robin.requadt's avatar robin.requadt
Browse files

Upload New File

parent 469a2839
"""
function [unew, method_input] = RRR(u, method_input)
% RRR.m
% written on Sept. 22, 2017 by
% Russell Luke
% Inst. Fuer Numerische und Angewandte Mathematik
% Inspired by the lecture of Veit Elser, Oaxaca, Sept. 22, 2017.
%
% DESCRIPTION: User-friendly version of the Relaxed Averaged Alternating Reflection algorithm.
% For background see:
% D.R.Luke, Inverse Problems 21:37-50(2005)
% D.R. Luke, SIAM J. Opt. 19(2): 714--739 (2008).
%
%
% INPUT: u, an array, and method_input, a data structure
%
% OUTPUT: method_input, the appended data structure with
% unew, an array
%
% USAGE: [unew, method_input] = RAAR(u,method_input)
%
% Nonstandard Matlab function calls: method_input.Prox1 and .Prox2
"""
from .SimpleAlgortihm import SimpleAlgorithm
import numpy as np
from numpy import exp
from proxtoolbox import ProxOperators
from .proxoperators import ProxOperator
class RRR(SimpleAlgorithm):
def __init__(self,config):
"""
Parameters
----------
config : dict
Dictionary containing the problem configuration.
It must contain the following mappings:
proxoperators: 2 ProxOperators
tuple of ProxOperators (the class, no instance)
beta0: number
Starting relaxation parmater
beta_max: number
Maximum relaxation parameter
beta_switch: int
Iteration at which beta moves from beta_0 -> beta_max
iter: int
prox_idx: int
"""
self.beta0 = config['beta0']
self.beta_max = config['beta_max']
self.beta_switch = config['beta_switch']
self.iter = config['iter']
self.prox1 = config['proxoperators'][0](config)
self.prox2 = config['proxoperators'][1](config)
if 'truth' in config:
self.truth = config['truth']
self.truth_dim = config['truth_dim']
self.norm_truth = config['norm_truth']
if 'diagnostic' in config:
self.diagnostic = True
else:
self.diagnostic = False
def evaluate(self, u):
beta0 =self.beta0
beta_max = self.beta_max
beta_switch = self.beta_switch
iter = self.iter
tmp1 = 2*(self.prox2.work(u))-u
tmp2 = self.prox1.work(tmp1)
#update
beta = exp((-iter/beta_switch)**3)*beta0+(1-exp((-iter/beta_switch)**3))*beta_max #unrelaxes
unew = beta*(2*tmp2-tmp1)/2 + (1-beta)*u
return unew
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment