make_params_key#
- lumopt2.utils.common.make_params_key(params: ndarray | None) bytes | None#
Build a canonical hashable cache key from a parameter array.
Wrapping
np.ascontiguousarray(..., dtype=np.float64).tobytes()in a helper guarantees that every cache (single-entry or multi-entry, inOptimizationorProject) hashes the same parameter vector to the same key, regardless of whether the caller passes a list, a non-contiguous view, or a different float dtype.- Parameters:
- params
np.ndarrayorNone Parameter values to hash.
Noneis passed through to allow the caller to record “no parameters cached”.
- params
- Returns: