nlsq.constants module¶
Constants for NLSQ optimization algorithms.
These values are derived from: - SciPy’s trust-region algorithms - Numerical optimization best practices - JAX performance characteristics
Overview¶
The constants module defines numerical constants and thresholds used throughout NLSQ.
Constants¶
This module provides:
Machine epsilon values for different dtypes
Convergence tolerances for optimization algorithms
Numerical stability thresholds
Default parameter values
Example Usage¶
from nlsq.constants import MACHINE_EPSILON, DEFAULT_XTOL, DEFAULT_FTOL
# Use in convergence checks
if abs(f_new - f_old) < DEFAULT_FTOL:
print("Converged based on function tolerance")
# Machine precision aware computations
safe_denominator = max(value, MACHINE_EPSILON)
See Also¶
nlsq.config module - Configuration management
nlsq.least_squares module - Uses constants for convergence criteria