Commit d3e6c7f9 authored by alexander.dornheim's avatar alexander.dornheim
Browse files

Added ProxOperator P_SP. Not yet tested.

parent 953c9894
......@@ -9,4 +9,4 @@ The "ProxOperators"-module contains all proximal operators that are already impl
from .proxoperators import *
__all__ = ["P_diag","P_parallel","magproj", "Approx_P_JWST_Poisson", "P_amp"]
__all__ = ["P_diag","P_parallel","magproj", "Approx_P_JWST_Poisson", "P_amp", "P_SP"]
......@@ -11,7 +11,7 @@ import numpy as np
from numpy import conj, dot, empty, ones, sqrt, sum, zeros, exp, nonzero, log, tile
from numpy.fft import fft2, ifft2
__all__ = ["P_diag","P_parallel","magproj", "Approx_P_JWST_Poisson", "P_amp"]
__all__ = ["P_diag","P_parallel","magproj", "Approx_P_JWST_Poisson", "P_amp", "P_SP"]
......@@ -257,7 +257,7 @@ class Approx_P_JWST_Poisson(ProxOperator):
self.product_space_dimension = config['product_space_dimension'];
self.abs_illumination = config['abs_illumination'];
#calculate the following once (not every iteration) for better performance (speedup ~20% for 500 Iterations JWST)
#calculate the following once (not every iteration) for better performance (speedup ~20# for 500 Iterations JWST)
self.exp_illu = exp(1j*self.illumination_phase)*tile(self.indicator_ampl[...,None],(1,1,self.product_space_dimension-1))
self.exp_illu_minus = exp(-1j*self.illumination_phase)*tile(self.indicator_ampl[...,None],(1,1,self.product_space_dimension-1))
......@@ -334,3 +334,30 @@ class P_amp(ProxOperator):
def work(self,u):
return magproj(u,self.amplitude); #argument order changed compared to matlab implementation!!!
# P_SP.m
# written on May 23, 2002 by
# Russell Luke
# Inst. Fuer Numerische und Angewandte Mathematik
# Universitaet Gottingen
#
# DESCRIPTION: Projection subroutine for projecting onto
# nonnegativity and support constraints
#
# INPUT: input, a data structure with .supp_ampl a vector of indeces of the nonzero elements of the array
# u = function in the physical domain to be projected
#
# OUTPUT: p_SP = the projection IN THE PHYSICAL (time) DOMAIN
#
# USAGE: p_SP = P_SP(input,u)
#
# Nonstandard Matlab function calls:
class P_SP(ProxOperator):
def __init__(self,config):
self.support_idx = config['support_idx'];
def work(self,u):
p_SP=zeros(shape(u));
p_SP[self.support_idx] = max(real(u[self.support_idx]),0);
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