From 5779011742f291db70750fb997544b612ac3ac45 Mon Sep 17 00:00:00 2001 From: Riley Murray Date: Fri, 17 Jan 2025 17:06:18 -0500 Subject: [PATCH] simplify bugfix from last commit --- pygsti/optimize/customlm.py | 3 +-- pygsti/optimize/simplerlm.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pygsti/optimize/customlm.py b/pygsti/optimize/customlm.py index 8541d9617..b3fd03a71 100644 --- a/pygsti/optimize/customlm.py +++ b/pygsti/optimize/customlm.py @@ -1129,11 +1129,10 @@ def dclip(ar): return ar try: _ = obj_fn(global_x, oob_check=True) # ^ Dead-store the return value. + new_x_is_known_inbounds = True except ValueError: # Then we keep new_x_is_known_inbounds==False. pass - else: - new_x_is_known_inbounds = True if new_x_is_known_inbounds: min_norm_f = norm_f best_x[:] = x[:] diff --git a/pygsti/optimize/simplerlm.py b/pygsti/optimize/simplerlm.py index 898cf0bd5..52e671498 100644 --- a/pygsti/optimize/simplerlm.py +++ b/pygsti/optimize/simplerlm.py @@ -789,11 +789,10 @@ def simplish_leastsq( try: _ = obj_fn(global_x, oob_check=True) # ^ Dead-store the return value. + new_x_is_known_inbounds = True except ValueError: # Then we keep new_x_is_known_inbounds==False. pass - else: - new_x_is_known_inbounds = True if new_x_is_known_inbounds: min_norm_f = norm_f best_x[:] = x[:]