response.bounds¶
Functions¶
clip_and_randomize ¶
Clip values to bounds with random replacement for out-of-bounds values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x | (ndarray, shape(N, n)) | Input matrix. | required |
lb | (ndarray, shape(1, n) or (n,)) | Lower bounds. | required |
ub | (ndarray, shape(1, n) or (n,)) | Upper bounds. | required |
Returns:
Type | Description |
---|---|
(ndarray, shape(N, n)) | Matrix where out-of-bounds values are replaced with uniform random values within [lb, ub] for each dimension. |
See Also
numpy.random.uniform : Used for random value generation.
Source code in pydmoo/response/bounds.py
clip_by_numpy ¶
Clip values to interval [lb, ub].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x | ndarray | Array containing elements to clip. | required |
lb | ndarray or scalar | Minimum value. | required |
ub | ndarray or scalar | Maximum value. | required |
Returns:
Type | Description |
---|---|
ndarray | Clipped array where: x_clipped = max(lb, min(ub, x)) |
Notes
This is a wrapper around numpy.clip() with identical behavior.
Source code in pydmoo/response/bounds.py
matrix_conditional_update ¶
Vectorized conditional matrix update with bounded interpolation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x_curr | (ndarray, shape(N, n)) | Observation matrix. | required |
lb | (ndarray, shape(1, n) or (n,)) | Lower bounds for each dimension. | required |
ub | (ndarray, shape(1, n) or (n,)) | Upper bounds for each dimension. | required |
x_prev | (ndarray, shape(N, n)) | Previous state matrix. | required |
Returns:
Type | Description |
---|---|
(ndarray, shape(N, n)) | Updated matrix where: - Values within bounds remain unchanged - Values below bounds become 0.5*(a + x_prev) - Values above bounds become 0.5*(b + x_prev) |
Notes
Uses NumPy broadcasting for efficient vectorized operations.