Skip to content
Merged
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
15 changes: 11 additions & 4 deletions simpeg/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@ def __init__(
cg_rtol: float = None,
cg_atol: float = None,
step_active_set: bool = True,
active_set_grad_scale: float = 1e-2,
active_set_grad_scale: float | np.ndarray = 1e-2,
**kwargs,
):
if (val := kwargs.pop("tolCG", None)) is not None:
Expand Down Expand Up @@ -1619,9 +1619,16 @@ def active_set_grad_scale(self) -> float:

@active_set_grad_scale.setter
def active_set_grad_scale(self, value: float):
self._active_set_grad_scale = validate_float(
"active_set_grad_scale", value, min_val=0, inclusive_min=True
)
try:
value = validate_float("active_set_grad_scale", value)
except TypeError:
value = validate_ndarray_with_shape(
Comment thread
domfournier marked this conversation as resolved.
"active_set_grad_scale", value, shape=("*",)
)
if np.any(value < 0.0):
raise ValueError("active_set_grad_scale must be >= 0.0")

self._active_set_grad_scale = value

@timeIt
def findSearchDirection(self):
Expand Down
Loading