pub struct PdSensBacksolver { /* private fields */ }Expand description
Adapter from PdFullSpaceSolver to SensBacksolver. Holds
owning clones of the four pieces of the algorithm’s converged
state, plus the 8-block iterate template used to allocate fresh
RHS / LHS vectors.
The PD solver lives behind an Rc<RefCell<…>> because
SensBacksolver::solve is &self but the upstream signature
for PdFullSpaceSolver::solve is &mut self (it caches the
last-solve dependency tags and the augsys-improved flag). The
RefCell is single-thread-only, single-borrow, exactly matching
the call pattern from pounce-sensitivity’s pipeline.
Owning (rather than borrowing) the four handles is what lets a
PdSensBacksolver outlive the on_converged callback frame —
required by the public Solver session API in pounce-algorithm,
which retains the backsolver for repeated parametric_step /
kkt_solve / compute_reduced_hessian calls after the IPM has
returned. The data, cq, and nlp handles are already
Rc<RefCell<…>> cheap-clone handles upstream, so this carries no
allocation overhead.
Implementations§
Source§impl PdSensBacksolver
impl PdSensBacksolver
Sourcepub fn new(
data: &IpoptDataHandle,
cq: &IpoptCqHandle,
nlp: &Rc<RefCell<dyn IpoptNlp>>,
pd: Rc<RefCell<PdFullSpaceSolver>>,
) -> Result<Self, ()>
pub fn new( data: &IpoptDataHandle, cq: &IpoptCqHandle, nlp: &Rc<RefCell<dyn IpoptNlp>>, pd: Rc<RefCell<PdFullSpaceSolver>>, ) -> Result<Self, ()>
Construct from the four handles handed in by the on_converged
callback. Returns Err(()) if data has no curr (i.e. the
algorithm never reached an iterate — should not happen on
SolveSucceeded).
Sourcepub fn block_dims(&self) -> [usize; 8]
pub fn block_dims(&self) -> [usize; 8]
Block dimensions of the compound KKT vector at convergence, in
(x, s, y_c, y_d, z_l, z_u, v_l, v_u) order. Sum equals
SensBacksolver::dim. Useful when a caller needs to compute
the flat offset of a non-x block (e.g. n_x + n_s for the
start of the equality-multiplier y_c block).
Source§impl PdSensBacksolver
impl PdSensBacksolver
Sourcepub fn solve_many(
&self,
rhs_flat: &[Number],
lhs_flat: &mut [Number],
n_rhs: usize,
) -> bool
pub fn solve_many( &self, rhs_flat: &[Number], lhs_flat: &mut [Number], n_rhs: usize, ) -> bool
Batched-RHS back-solve over the held factor. rhs_flat and
lhs_flat are row-major (n_rhs, dim) buffers. Equivalent to
looping SensBacksolver::solve over each row but reuses one
frozen IteratesVector for the RHS and one IteratesVectorMut
for the result across all n_rhs calls into
PdFullSpaceSolver::solve. The pack step writes into the
existing DenseVector storage via Rc::get_mut +
set_values, and the unpack step reads it back via values()
/scalar() — skipping the per-call 8-block make_new_zeroed
(Box alloc) in pack and the per-block expanded_values() Vec
alloc in unpack that otherwise dominate the held-factor
back-solve cost under jax.jacrev over a JaxProblem solve
(pounce#77 follow-up).
The matrix and perturbation state inside PdFullSpaceSolver
are unchanged across calls, so each iteration hits the cached
fast path in solve_once (uptodate && !pretend_singular).
Trait Implementations§
Source§impl Clone for PdSensBacksolver
impl Clone for PdSensBacksolver
Source§fn clone(&self) -> PdSensBacksolver
fn clone(&self) -> PdSensBacksolver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl SensBacksolver for PdSensBacksolver
impl SensBacksolver for PdSensBacksolver
Auto Trait Implementations§
impl !RefUnwindSafe for PdSensBacksolver
impl !Send for PdSensBacksolver
impl !Sync for PdSensBacksolver
impl !UnwindSafe for PdSensBacksolver
impl Freeze for PdSensBacksolver
impl Unpin for PdSensBacksolver
impl UnsafeUnpin for PdSensBacksolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more