Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproximal/proximal/Box.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
self.box = BoxProj(self.lower, self.upper)

def __call__(self, x: NDArray) -> bool:
return bool(np.all((x > self.lower) & (x < self.upper)))
return bool(np.all((x >= self.lower) & (x <= self.upper)))

@_check_tau
def prox(self, x: NDArray, tau: float) -> NDArray:
Expand Down
5 changes: 5 additions & 0 deletions pytests/test_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def test_Box(par):
box = Box(-1, 1)
x = np.random.normal(0.0, 1.0, par["nx"]).astype(par["dtype"])

# evaluation
assert box(x) is False
xp = box.prox(x, 1.0)
assert box(xp) is True

# prox / dualprox
tau = 2.0
assert moreau(box, x, tau)
Expand Down