Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeff committed Jan 31, 2019
1 parent 5e29b1f commit 829dacd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions pyunlocbox/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,10 @@ def _prox(self, x, T):
# Initialization.
sol = x
u = np.zeros(np.shape(self.y()))
if self.method is 'FISTA':
if self.method == 'FISTA':
v_last = u
t_last = 1.
elif self.method is not 'ISTA':
elif self.method != 'ISTA':
raise ValueError('The method should be either FISTA or ISTA.')

# Tolerance around the L2-ball.
Expand All @@ -910,7 +910,7 @@ def _prox(self, x, T):
res = self.A(sol) - self.y()
norm_res = np.linalg.norm(res, 2)

if self.verbosity is 'HIGH':
if self.verbosity == 'HIGH':
print(' proj_b2 iteration {:3d}: epsilon = {:.2e}, '
'||y-A(z)||_2 = {:.2e}'.format(niter, self.epsilon,
norm_res))
Expand All @@ -922,7 +922,7 @@ def _prox(self, x, T):
ratio = min(1, self.epsilon / norm_proj)
v = 1. / self.nu * (res - res * ratio)

if self.method is 'FISTA':
if self.method == 'FISTA':
t = (1. + np.sqrt(1. + 4. * t_last**2.)) / 2. # Time step.
u = v + (t_last - 1.) / t * (v - v_last)
v_last = v
Expand Down
10 changes: 5 additions & 5 deletions pyunlocbox/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def _pre(self, functions, x0):
raise ValueError('Gradient descent requires each function to '
'implement grad().')

if self.verbosity is 'HIGH':
if self.verbosity == 'HIGH':
print('INFO: Gradient descent minimizing {} smooth '
'functions.'.format(len(self.smooth_funs)))

Expand Down Expand Up @@ -542,7 +542,7 @@ def __init__(self, accel=acceleration.fista(), **kwargs):

def _pre(self, functions, x0):

if self.verbosity is 'HIGH':
if self.verbosity == 'HIGH':
print('INFO: Forward-backward method')

if len(functions) != 2:
Expand Down Expand Up @@ -629,10 +629,10 @@ def _pre(self, functions, x0):
raise ValueError('Generalized forward-backward requires each '
'function to implement prox() or grad().')

if self.verbosity is 'HIGH':
if self.verbosity == 'HIGH':
print('INFO: Generalized forward-backward minimizing {} smooth '
'functions and {} non-smooth functions.'.format(len(self.smooth_funs),
len(self.non_smooth_funs)))
'functions and {} non-smooth functions.'.format(
len(self.smooth_funs), len(self.non_smooth_funs)))

def _algo(self):

Expand Down

0 comments on commit 829dacd

Please sign in to comment.