Clamping
📐 Definition
Section titled “📐 Definition”For bounds and scalar ,
Domain and Codomain
Section titled “Domain and Codomain”Domain: real numbers (or componentwise on vectors). Codomain: .
⚙️ Key Properties
Section titled “⚙️ Key Properties”Non-expansive: . Piecewise linear and idempotent: applying twice leaves the result unchanged.
When or , clamping reduces to one-sided thresholding. Choosing collapses all inputs to the constant bound.
🎯 Special Cases and Limits
Section titled “🎯 Special Cases and Limits”- One-sided clamp corresponds to thresholding.
- yields a constant map.
🔗 Related Functions
Section titled “🔗 Related Functions”Soft clamping replaces hard corners with smooth transitions; thresholding is the one-sided variant.
Usage in Oakfield
Section titled “Usage in Oakfield”Oakfield uses clamping both as a low-level numeric utility and as part of operator “safety” policies:
- Warp continuity guards clamp or limit invalid warp-gradient samples via per-operator
continuitysettings (none|strict|clamped|limited) andclamp_min/clamp_max. - Thermostat regulation optionally bounds regulated parameters (e.g.
lambda_min/lambda_max, with a smooth clamp option). - Integrator safety clamps adaptive timesteps to
min_dt/max_dt. - Math helpers in
core/math_utils.hincludesim_clamp_doubleand magnitude-preservingsim_clamp_complex.
Historical Foundations
Section titled “Historical Foundations”📜 Projection onto an Interval
Section titled “📜 Projection onto an Interval”Clamping is the projection of a scalar onto the closed interval , a basic operation in constrained optimization and numerical safeguards.
🌍 Modern Perspective
Section titled “🌍 Modern Perspective”Hard clamps are commonly replaced by smooth clamps when differentiability is required, but the hard version remains a robust safeguard primitive.
📚 References
Section titled “📚 References”- Boyd & Vandenberghe, Convex Optimization