Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
nam
ProxPython
Commits
18bbf6c3
Commit
18bbf6c3
authored
Apr 06, 2019
by
robin.requadt
Browse files
Upload New File
parent
f61bb185
Changes
1
Hide whitespace changes
Inline
Side-by-side
proxtoolbox/ProxOperators/P_S_real.py
0 → 100644
View file @
18bbf6c3
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment