Skip to main content

Crate hyperjet

Crate hyperjet 

Source
Expand description

§nolan (hyperjet) — forward-mode automatic differentiation with const-generic jets

Forward-mode automatic differentiation built around const-generic, stack-allocated hyperdual numbers (jets): Jet1<N> for gradients, Jet2<N, H> for full Hessians, and Jet3<N, H, T> for third-order tensors. No Vec, no Box, no heap. The same function body type-checks against f64 (no derivatives), Jet1 (gradients), Jet2 (Hessians), or Jet3 (third-order tensors).

use hyperjet::jets::Jet1;

let x = Jet1::<2>::variable(1.5, 0);
let y = Jet1::<2>::variable(2.0, 1);
let f = x * x + y;
assert_eq!(f.value, 4.25);
assert_eq!(f.grad, [3.0, 1.0]); // df/dx = 2x = 3, df/dy = 1

§What’s in the box

  • jetsJet1<N> / Jet2<N, H> / Jet3<N, H, T> types and operator impls. Stack-allocated, const-generic over parameter count.
  • traitsDifferentiable, FirstOrder, SecondOrder, ThirdOrder, DifferentiableMath, AutoDiff — write functions once, run with any jet order.
  • differentiate — convenience wrappers (differentiate1, differentiate2_6, differentiate3_9, runtime-dispatched differentiate_dyn_*) that hide the jet seeding + extraction boilerplate.
  • linalg — stack-allocated generic matrix operations (mat_solve, mat_inv, mat_cholesky, eigendecomposition, condition number, covariance regularization) that compose with any jet order.
  • statistics — multivariate Gaussian primitives (sigma points, Gaussian-mixture splitting, sample statistics) and scalar distributions (ln_gamma, chi2_sf, etc.).
  • gridslinspace, logspace, linear_clamped.
  • angleswrap_pi, wrap_2pi, wrap_180, wrap_360.

Built for astrodynamics (orbit determination, covariance propagation, close-approach sensitivity analysis), but the core types are domain-agnostic and useful anywhere exact stack-allocated forward-mode derivatives matter: optimization, robotics inverse kinematics, physics simulation, ML gradient checking, sensitivity analysis.

Modules§

angles
Angle wrapping primitives.
differentiate
Generic differentiate convenience API.
grids
1D grid generation and linear interpolation primitives.
impls
jets
linalg
Linear algebra primitives generic over T: DifferentiableMath.
optimization
Nonlinear least-squares optimization.
statistics
Statistical primitives.
traits

Functions§

version
Returns the full version string, e.g. “1.0.0+a3f7b2c” or “1.0.1-dev+f82c1a0-dirty”.