Skip to content

Commit

Permalink
Specified action if a negative number of samples requested
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrey-hokanson committed Jun 8, 2020
1 parent 0c561ae commit 92295aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions psdr/domains/euclidean.py
Expand Up @@ -620,6 +620,11 @@ def sample(self, draw = 1):
If we are unable to find a point in the domain satisfying the constraints
"""
draw = int(draw)

# If request a non positive number of samples, simply return zero
if draw <= 0:
return np.zeros((0, len(self)))

x_sample = self._sample(draw = draw)
if draw == 1:
x_sample = x_sample.flatten()
Expand Down

0 comments on commit 92295aa

Please sign in to comment.