minuit2-rs — Pure Rust Port of Standalone Minuit2
Minuit2 is CERN's parameter optimization engine, the standard in high-energy physics since 1975. This project ports the standalone extraction to Rust — no C++, no ROOT.
Features
- Pure Rust. No C++ toolchain, no unsafe blocks, zero-cost abstractions.
- Robust Algorithms. Migrad (Variable Metric), Simplex (Nelder-Mead), Hesse (Exact Errors), Minos (Asymmetric Errors).
- Analytical Gradients. Support for user-provided gradients for faster convergence.
- Python Bindings. High-performance PyO3 bindings for integration with Python workflows.
- Parallel Processing. Optional
rayonsupport for parallel parameter scans. - Numerical Stability. Resilience against
NaNandInfinitywith automatic recovery.
Quick Start
use MnMigrad;
let result = new
.add
.add
.minimize;
println!;
Analytical Gradients
Use analytical gradients to significantly reduce the number of function calls:
use ;
;
let result = new
.add
.add
.minimize_grad;
Feature Flags
python: Enables PyO3 bindings (Minuitclass).parallel: Enablesrayonsupport for parallelMnScan.
[]
= { = "0.3", = ["python", "parallel"] }
Current Status
| Minimizer | Status | Description |
|---|---|---|
| MnMigrad | Done | Quasi-Newton (DFP) — recommended for smooth functions |
| MnSimplex | Done | Nelder-Mead (Minuit variant) — derivative-free |
| MnHesse | Done | Full Hessian calculation for accurate errors |
| MnMinos | Done | Asymmetric error estimation |
| MnScan | Done | 1D parameter scans (Parallel support available) |
| MnContours | Done | 2D confidence contours |
Robustness & Security
minuit2-rs is built for reliability in scientific computing:
- Zero Unsafe. The entire codebase is written in 100% safe Rust.
- Numerical Resilience. Gracefully handles
NaNandInfby treating them as high-value penalties, preventing optimizer crashes. - Stress Tested. Validated against 50-parameter problems and rugged landscapes like the Goldstein-Price function.
Upstream Source
GooFit/Minuit2 — ~14.5k LOC, 187 C++ files.
This port replaces custom C++ linear algebra with nalgebra and manual memory management with Rust's ownership model.
License
MIT OR Apache-2.0