Skip to main content

eindir_core/
lib.rs

1#![warn(missing_docs)]
2//! eindir-core: typed primitives for ND objective functions.
3//!
4//! This crate ships the typed primitives (FPair, Bounds, Objective trait,
5//! gradients, surrogates, point sets, and builtin objective implementations)
6//! consumed by `anneal-core`.
7
8/// Forward-mode automatic differentiation via `num-dual`.
9#[cfg(feature = "autodiff")]
10pub mod autodiff;
11/// Separable rank-1 surrogate and its tempered independence sampler.
12pub mod additive;
13/// Box bounds on N-dimensional points.
14pub mod bounds;
15/// Error types shared by all fallible operations in `eindir-core`.
16pub mod error;
17/// Box geometry features and compensated ΔE.
18pub mod features;
19/// C ABI surface, gated behind the `capi` Cargo feature.
20#[cfg(feature = "capi")]
21#[allow(non_camel_case_types)]
22pub mod ffi;
23/// Position-value pairs.
24pub mod fpair;
25/// Generalized Langevin equation colored-noise thermostat (optimal sampling).
26pub mod gle;
27/// Gradient trait and adapters (Analytic / FiniteDiff) plus
28/// `DifferentiableObjective`.  "Native" gradients when the caller can
29/// supply them (Ceres-style); explicit central differences otherwise.
30pub mod gradient;
31/// The `Objective` trait: typed `S -> R` map with bounds and optional known minimum.
32pub mod objective;
33/// Builtin objective-function implementations for benchmarking and tests.
34pub mod objectives;
35/// Low-discrepancy point sets for bounded numerical objectives.
36pub mod pointset;
37/// Adapter wrapping a Python callable into the Rust `Objective<f64>` trait.
38#[cfg(any(feature = "python", feature = "py-objective"))]
39pub mod py_objective;
40/// pyo3 bindings for `eindir._core`, gated behind the `python` Cargo feature.
41#[cfg(feature = "python")]
42pub mod python;
43/// Dimension-collapse and Chebyshev surrogate `Obj`-transforms.
44pub mod reduced;
45/// Shared algebra-facing type definitions.
46pub mod types;
47
48#[cfg(feature = "autodiff")]
49pub use autodiff::{DualField, ForwardAd};
50pub use additive::AdditiveSurrogate;
51pub use bounds::Bounds;
52pub use error::Error;
53pub use features::{BoxGeometry, box_geometry, compensated_delta, isotropic_proposal_scale};
54pub use fpair::FPair;
55pub use gle::{GleThermostat, OPTIMAL_SAMPLING_NS, ldl_sqrt, matrix_exp, optimal_sampling_drift};
56pub use gradient::{AnalyticGradient, DifferentiableObjective, FiniteDiffGradient, Gradient};
57pub use objective::{EVAL_BATCH_PARALLEL_MIN, Objective, eval_batch_parallel};
58pub use objectives::{Ackley, Rastrigin, Rosenbrock, StybTang2D};
59pub use pointset::{
60    boundary_anchored_low_discrepancy_points, halton_points, halton_unit, low_discrepancy_points,
61    radical_inverse, shifted_halton_points, shifted_low_discrepancy_points,
62};
63pub use reduced::{ChebyshevSurrogate, ReducedObjective};
64
65#[cfg(feature = "capi")]
66pub use ffi::{
67    EindirEvalFn, EindirFreeFn, EindirGradFn, EindirObjectiveWrapper, eindir_abi_stamp_t,
68    eindir_objective_t,
69};