Classes | |
| class | ADAM |
| Adaptive Moment Estimation (ADAM) optimizer. More... | |
| class | Ceres |
| Wrapper for the Ceres Solver for robust nonlinear optimization. More... | |
| class | GprCostFunction |
| struct | MapObjectiveConfig |
| class | RgminCallbackFailure |
| class | RgminLbfgs |
| L-BFGS waist through rgmin. The loop lives in Rust. More... | |
| struct | RgminNlmlCtx |
| class | RgminOpt |
| class | RgminScg |
| struct | RgminTensorDeleter |
Concepts | |
| concept | NlmlHessianVectorHolder |
Typedefs | |
| using | ParamOptimizer = std::variant<RgminScg, RgminOpt> |
| using | RgminTensorHandle |
Functions | |
| bool | mapParametersInDomain (const Eigen::VectorXd &w, const MapObjectiveConfig &cfg) |
| void | projectMapGradient (const MapObjectiveConfig &cfg, Eigen::VectorXd &gradient) |
| double | mapHalfCauchyASq (double signal_variance) noexcept |
| double | mapMaxLogMagnSigma2 (double signal_variance) noexcept |
| void | restoreMapAmplitudeFeasibility (Eigen::VectorXd &w, const MapObjectiveConfig &cfg) |
| double | mapLengthscaleRho0 (const MapObjectiveConfig &cfg, Eigen::Index i) noexcept |
| Eigen::Index | mapLengthscaleEnd (const MapObjectiveConfig &cfg, Eigen::Index size) noexcept |
| double | mapMedianInPlace (std::vector< double > &v) noexcept |
| double | mapRobustMadVariance (const Eigen::VectorXd &block) |
| double | mapForceImpliedSignalVariance (const gpr::EigenMatrix &x, Eigen::Index n_e, const Eigen::VectorXd &y, const Eigen::VectorXd &w) |
| double | mapRobustSignalVarianceAnchor (const gpr::EigenMatrix &x, Eigen::Index n_e, const Eigen::VectorXd &y, const Eigen::VectorXd &w) |
| double | mapBayesPriorWeight (const MapObjectiveConfig &cfg) noexcept |
| bool | mapLogNormalMagnPriorActive (const MapObjectiveConfig &cfg) noexcept |
| bool | mapMagnPriorActive (const MapObjectiveConfig &cfg) noexcept |
| double | mapPriorWeight (const MapObjectiveConfig &cfg, Eigen::Index i, Eigen::Index count) noexcept |
| bool | mapLengthscalePriorActive (const MapObjectiveConfig &cfg) noexcept |
| void | mapConfigFromSettings (const gpr::ScgOptimizationSettings &settings, MapObjectiveConfig &cfg) |
| MapObjectiveConfig | makeMapObjectiveConfig (const gpr::EigenMatrix &x, const Eigen::VectorXd &y, const Eigen::VectorXd &w, double current_barrier_strength, const Eigen::VectorXd &lengthscale_rho0, const gpr::ScgOptimizationSettings &settings, bool robust_signal_anchor=true) |
| void | applyMapPenalty (const Eigen::VectorXd &w, const MapObjectiveConfig &cfg, double &energy, Eigen::VectorXd *gradient) |
| bool | applyMapPenaltyGradient (const Eigen::VectorXd &w, const MapObjectiveConfig &cfg, Eigen::VectorXd &gradient) |
| double | mapPenaltyDirectionalCurvature (const Eigen::VectorXd &w, const Eigen::VectorXd &direction, const MapObjectiveConfig &cfg) |
| void | mapPenaltyHessianVector (const Eigen::VectorXd &w, const Eigen::VectorXd &direction, const MapObjectiveConfig &cfg, Eigen::VectorXd &product) |
| template<typename Holder> | |
| bool | holderHasNlmlHessianVector (Holder &holder) |
| template<typename Holder> | |
| bool | holderNlmlHessianVector (Holder &holder, const Eigen::VectorXd &x_ind, const gpr::EigenMatrix &x, const Eigen::VectorXd &y, const Eigen::VectorXd &direction, Eigen::VectorXd &product) |
| template<typename Holder> | |
| bool | holderNlmlDirectionalCurvature (Holder &holder, const Eigen::VectorXd &x_ind, const gpr::EigenMatrix &x, const Eigen::VectorXd &y, const Eigen::VectorXd &direction, double &curvature) |
| Eigen::Map< const Eigen::VectorXd > | tensorToVec (const DLManagedTensorVersioned *tensor) |
| Eigen::Map< Eigen::VectorXd > | tensorToVec (DLManagedTensorVersioned *tensor) |
| template<typename Ctx> | |
| rgmin_status_t | rgminEval (void *user, const DLManagedTensorVersioned *x, double *value_out) noexcept |
| template<typename Ctx> | |
| rgmin_status_t | rgminGrad (void *user, const DLManagedTensorVersioned *x, DLManagedTensorVersioned *grad_out) noexcept |
| template<typename Ctx> | |
| rgmin_status_t | rgminCurv (void *user, const DLManagedTensorVersioned *x, const DLManagedTensorVersioned *d, double *curv_out) noexcept |
| template<typename Ctx> | |
| rgmin_status_t | rgminNlmlHessianVectorCurv (void *user, const DLManagedTensorVersioned *x, const DLManagedTensorVersioned *d, double *curv_out) noexcept |
Variables | |
| constexpr double | kMapStudentTNu = 4.0 |
| Weakly-informative Student-t hyperparameters on lengthscales. | |
| constexpr double | kMapStudentTSigmaSq = 1.0 |
| constexpr double | kMapStudentTNorm = 0.5 * (kMapStudentTNu + 1.0) |
| constexpr double | kMadConsistencyConstant = 1.4826 |
| using funcmin::ParamOptimizer = std::variant<RgminScg, RgminOpt> |
Definition at line 26 of file ParamOpt.h.
Definition at line 36 of file RgminObjective.h.
|
inline |
Apply MAP prior penalties (energy + optional gradient) and log-barriers. Energy is assumed to already hold the base NLML. On barrier violation sets energy to +inf; when gradient is non-null, zeros it on tail-barrier failure.
Definition at line 402 of file MapObjective.h.
|
inline |
Gradient-only MAP prior + barrier contributions (the path that reuses an accepted energy probe). Returns false and zeros gradient on barrier failure or non-finite result.
Definition at line 552 of file MapObjective.h.
|
nodiscard |
True when the optimizer's holder offers the exact Hessian-vector product of the objective it currently evaluates.
Definition at line 32 of file NlmlCurvature.h.
| bool funcmin::holderNlmlDirectionalCurvature | ( | Holder & | holder, |
| const Eigen::VectorXd & | x_ind, | ||
| const gpr::EigenMatrix & | x, | ||
| const Eigen::VectorXd & | y, | ||
| const Eigen::VectorXd & | direction, | ||
| double & | curvature ) |
d^T H d from the holder's exact NLML Hessian-vector product. False, with a NaN curvature, when the holder has no such product or it fails.
Definition at line 64 of file NlmlCurvature.h.
| bool funcmin::holderNlmlHessianVector | ( | Holder & | holder, |
| const Eigen::VectorXd & | x_ind, | ||
| const gpr::EigenMatrix & | x, | ||
| const Eigen::VectorXd & | y, | ||
| const Eigen::VectorXd & | direction, | ||
| Eigen::VectorXd & | product ) |
The holder's exact NLML Hessian-vector product H v. False when the holder has no such product, it is unavailable, or it fails or returns a vector of the wrong size or a non-finite one.
Definition at line 45 of file NlmlCurvature.h.
|
inline |
Build the objective once from the observations and initial parameters. GP fits use the robust energy and force anchor with every minimizer.
Definition at line 367 of file MapObjective.h.
|
inlinenoexcept |
Prior weight for the bayesian prior terms. Barrier terms always use barrier_strength regardless of weight_mode.
Definition at line 307 of file MapObjective.h.
|
inline |
Fill MapObjectiveConfig prior fields and weight mode from the rgmin optimizer settings (populated by Optimize.cpp / unit tests).
Definition at line 342 of file MapObjective.h.
|
inline |
Force-implied signal-variance floor from the SExpAt kernel Hessian identity Var[dE/dc] = sf2 * sum_p (dd_p/dc)^2 / l_p^2 for descriptors d_p = 1/r_p (verified symbolically in tests/symbolic/test_sexpat_force_variance.py). The exact chain rule gives dd_p/dc = -Delta_c / r_p^3 for a single Cartesian coordinate c of one of the pair's two atoms (Delta_c the corresponding coordinate difference), so abs(dd_p/dc) <= 1/r_p^2, tight when the pair lies along c.
SCG anchor time has the training Cartesian coordinates (the energy block of x, rows [0, n_e), columns [0, x.cols()-1) once the trailing block-index column is dropped – see AuxiliaryFunctionality::assembleMatrixOfRepetitiveCoordinates) and the current lengthscales (w(i) = log(l_i), i = 1..P), but not the pairtype-to-atom-pair map (that lives in AtomsConfiguration, only available at the covariance-function layer), so the true l_p for each atom pair is unknown here. J_med decouples the sum into two robust medians instead: the median inverse-lengthscale-squared over the current pairtypes, times the squared median of the tight per-pair bound 1/r_p^2 over every atom pair and every training row in the energy block.
Definition at line 235 of file MapObjective.h.
|
inlinenoexcept |
Definition at line 114 of file MapObjective.h.
|
inlinenoexcept |
One past the last length-scale coordinate. A negative count keeps the historical rule that every coordinate after the magnitude is a length scale.
Definition at line 166 of file MapObjective.h.
|
inlinenoexcept |
Definition at line 334 of file MapObjective.h.
|
inlinenoexcept |
rho0_k lookup for w(i), i = 1..w.size()-1 (lengthscale block). Returns cfg.lengthscale_rho0(i - 1) when that entry is finite and positive; otherwise returns 1.0, exactly reproducing the pre-anchor Student-t prior (raw ell_i in implicit unit-Angstrom-equivalent descriptor units) for that index. No global on/off switch: an empty or short lengthscale_rho0 vector falls back index-by-index, so a partially-degenerate descriptor spread (one pairtype with too few observations) only loses scale-freedom for that one pairtype.
Definition at line 153 of file MapObjective.h.
|
inlinenoexcept |
Definition at line 313 of file MapObjective.h.
|
inlinenoexcept |
Definition at line 320 of file MapObjective.h.
|
inlinenoexcept |
Definition at line 119 of file MapObjective.h.
|
inlinenoexcept |
Median of a vector, sorting in place (even-length: mean of the two middle elements).
Definition at line 183 of file MapObjective.h.
|
inline |
Reject invalid trials before invoking a covariance objective. Infinite endpoints leave a side unbounded; NaN or mismatched bounds are invalid.
Definition at line 78 of file MapObjective.h.
|
inline |
Directional curvature of the selected MAP prior and barrier terms. Natural-space priors include their log-coordinate Jacobian, and tied parameters carry the same prior weights as applyMapPenalty.
Definition at line 650 of file MapObjective.h.
|
inline |
Hessian-vector product of the MAP penalty. The penalty Hessian is diagonal in the log coordinates, so column i is mapPenaltyDirectionalCurvature(e_i) times the i-th component of the direction.
Definition at line 741 of file MapObjective.h.
|
inlinenoexcept |
Definition at line 326 of file MapObjective.h.
|
inline |
Robust (MAD-based) variance of a data block: sigma_robust = kMadConsistencyConstant * median(abs(v - median(v))), var = sigma_robust^2. Falls back to the plain sample variance when the MAD is degenerate (block constant or empty), matching the un-robust estimator in that limit.
Definition at line 195 of file MapObjective.h.
|
inline |
Force-aware signal-variance anchor for the magnSigma2 prior and ceiling. The GP trains on energies AND gradients under one shared amplitude; an energy-channel robust variance is blind to the force scale the kernel must also represent, so the half-Cauchy prior scale and the ceiling built from it (mapMaxLogMagnSigma2) can pin magnSigma2 below what the observed force residuals need to be representable as posterior uncertainty. The anchor takes the larger of the energy-block MAD variance and the force-implied floor (mapForceImpliedSignalVariance), then floors at 1e-6 so a degenerate (all-equal) target block never yields a zero or negative ceiling.
Definition at line 295 of file MapObjective.h.
|
inline |
Restrict the optimizer gradient while retaining the full objective and covariance. Empty masks leave the complete parameter space available.
Definition at line 94 of file MapObjective.h.
|
inline |
Preserve a feasible warm start. An amplitude outside the fitted MAP domain returns to the half-Cauchy prior scale, with every other parameter unchanged. The gap to the ceiling is log(100*s)-log(2*s)=log(50)>0.
Definition at line 135 of file MapObjective.h.
|
noexcept |
Definition at line 391 of file RgminObjective.h.
|
noexcept |
Definition at line 342 of file RgminObjective.h.
|
noexcept |
Definition at line 363 of file RgminObjective.h.
|
noexcept |
Curvature of the nlml_hessian_vector mode: d^T H d from the holder's exact NLML Hessian-vector product plus the MAP penalty. A product that fails or is not finite sets hessian_vector_fallback and answers RGMIN_UNAVAILABLE, for this and every later direction; rgmin then takes the curvature from its finite-difference probe, the finite_difference mode's path. An exception from the holder fails the context as in rgminCurv.
Definition at line 423 of file RgminObjective.h.
| Eigen::Map< const Eigen::VectorXd > funcmin::tensorToVec | ( | const DLManagedTensorVersioned * | tensor | ) |
Definition at line 40 of file RgminObjective.cpp.
| Eigen::Map< Eigen::VectorXd > funcmin::tensorToVec | ( | DLManagedTensorVersioned * | tensor | ) |
Definition at line 50 of file RgminObjective.cpp.
|
inlineconstexpr |
Standard-normal consistency constant for the median absolute deviation: sigma_hat = kMadConsistencyConstant * median(abs(v - median(v))) is a consistent estimator of the standard deviation of an underlying normal (Ruppert, "Statistics and Finance", 2004, sec 3.2).
Definition at line 179 of file MapObjective.h.
|
inlineconstexpr |
Definition at line 112 of file MapObjective.h.
|
inlineconstexpr |
Weakly-informative Student-t hyperparameters on lengthscales.
Definition at line 110 of file MapObjective.h.
|
inlineconstexpr |
Definition at line 111 of file MapObjective.h.