Commit 18bbf6c3 authored by robin.requadt's avatar robin.requadt
Browse files

Upload New File

parent f61bb185
import numpy as np
from proxoperators import ProxOperator
"""
#original matlab comment
% P_S_real.m
% written on May 23, 2002 by
% Russell Luke
% Inst. Fuer Numerische und Angewandte Mathematik
% Universitaet Gottingen
%
% DESCRIPTION: Projection subroutine for projecting onto
% support constraints
%
% INPUT: input = data structure with .supp_ampl a vector of indeces of the nonzero elements of the array.
%
% u = array to be projected
%
% OUTPUT: p_S = the projection
%
% USAGE: p_S = P_S(input,u)
%
% Nonstandard Matlab function calls:
"""
class P_S_real(ProxOperator):
def __init__(self,config):
"""
Initialization
Parameters
----------
config : dict - Dictionary containing the problem configuration. It must contain the following mapping:
'support_idx' : array_like
"""
self.support_idx = config['support_idx']
def work(self,u):
"""
Parameters
----------
u : array_like - Input
Returns
-------
p_S : array_like
"""
support_idx = self.support_idx
p_S = np.zeros(u.shape, dtype=u.dtype)
p_S[support_idx] = np.real(u[support_idx])
return p_S
Markdown is supported
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