feat: Engine diagnostics #92

Merged
glen merged 16 commits from Vectornaut/dyna3:diagnostics into main 2025-07-21 04:18:50 +00:00
Showing only changes of commit c3c665f35c - Show all commits

View file

@ -490,13 +490,22 @@ pub fn realize_gram(
if state.loss < tol { break; }
// compute the Newton step
/* TO DO */
/*
we need to either handle or eliminate the case where the minimum
eigenvalue of the Hessian is zero, so the regularized Hessian is
singular. right now, this causes the Cholesky decomposition to return
`None`, leading to a panic when we unrap
we should change our regularization to ensure that the Hessian is
is positive-definite, rather than just positive-semidefinite. ideally,
that would guarantee the success of the Cholesky decomposition---
although we'd still need the error-handling routine in case of
numerical hiccups
*/
let base_step_stacked = hess.clone().cholesky().unwrap().solve(&neg_grad_stacked);
let hess_cholesky = match hess.clone().cholesky() {
Some(cholesky) => cholesky,
None => return RealizationResult {
result: Err("Cholesky decomposition failed".to_string()),
history
}
};
let base_step_stacked = hess_cholesky.solve(&neg_grad_stacked);
let base_step = base_step_stacked.reshape_generic(Dyn(element_dim), Dyn(assembly_dim));
history.base_step.push(base_step.clone());