Skip to content

Commit

Permalink
Resolve a bug when it comes to the setting of the k_max value, which …
Browse files Browse the repository at this point in the history
…was wrong on the previous version
  • Loading branch information
LElgueddari committed Dec 17, 2019
1 parent c7e17a0 commit 4464aa4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modopt/opt/proximity.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,10 +957,11 @@ def _op_method(self, data, extra_factor=1.0):
"""
data_shape = data.shape
if self._k_value > data.shape[0]:
k_max = np.prod(data_shape)
if self._k_value > k_max:
warn("K value of the K-support norm is greater than the input" +
" dimension, its value will be set to " + str(data.shape[0]))
self._k_value = data.shape[0]
" dimension, its value will be set to " + str(k_max))
self._k_value = k_max

# Computes line 1., 2. and 3. in Algorithm 1
alpha = self._find_alpha(np.abs(data.flatten()), extra_factor)
Expand Down

0 comments on commit 4464aa4

Please sign in to comment.