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

Update P_binary.py: tabs to spaces, fixed typos

parent 8bc6b016
import numpy as np
from numpy import shape, real, zeros
from proxoperators import Proxoperator
from proxoperators import ProxOperator
#original matlab comment
# written on May 23, 2002 by
# Russell Luke
......@@ -18,17 +18,17 @@ from proxoperators import Proxoperator
# USAGE: p_binary = P_binary(input,u)
#
class P_binary(ProxOperators):
class P_binary(ProxOperator):
def __init__(self, config):
"""
Initialization
Initialization
Parameters
----------
config : dict - Dictionary containing the problem configuration. It must contain the following mappings:
support_idx : array_like - vector of indeces of the nonzero elements of the array
"""
support_idx : array_like - vector of indeces of the nonzero elements of the array
"""
self.support_idx = config['support_idx']
def work(self,u):
......@@ -43,9 +43,9 @@ class P_binary(ProxOperators):
"""
support_idx = self.support_idx
p_binary=zeros(shape(u), np.float64)
p_binary=zeros(shape(u), np.float64)
p_binary[support_idx] = np.sign(real(u[support_idx])-0.5)
p_binary[support_idx] = np.maximum(p_binary[support_idx],1)
p_binary[support_idx] = np.maximum(p_binary[support_idx],1)
return p_binary
......
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