pub struct HessianProgram { /* private fields */ }Expand description
Precompiled Hessian-of-one-tape program. Built once via
HessianProgram::compile; executed many times.
Implementations§
Source§impl HessianProgram
impl HessianProgram
Sourcepub fn compile(
tape: &Tape,
hess_map: &HashMap<(usize, usize), usize>,
) -> Option<Self>
pub fn compile( tape: &Tape, hess_map: &HashMap<(usize, usize), usize>, ) -> Option<Self>
Build the program. The hess_map is the same (row, col) -> values-index map that Tape::hessian_accumulate uses;
the compiler inlines each lookup into a HessEmit op.
Returns None when tape contains an opcode the program path
cannot lower (see [program_supports_op]). A caller must fall
back to the Tape (build_with_externals) interpreter path for
those tapes — this is a graceful signal, not a panic, so a
problem built from arbitrary user .nl input can never crash the
process here (code review L28).
pub fn n_slots(&self) -> usize
pub fn n_ops(&self) -> usize
Sourcepub fn execute(
&self,
x: &[f64],
weight: f64,
scratch: &mut [f64],
values: &mut [f64],
)
pub fn execute( &self, x: &[f64], weight: f64, scratch: &mut [f64], values: &mut [f64], )
Execute the program. scratch is overwritten throughout;
it must be at least [n_slots] long. values is the
shared Hessian-values buffer the caller is accumulating
into (same semantics as
Tape::hessian_accumulate’s values).
Trait Implementations§
Source§impl Clone for HessianProgram
impl Clone for HessianProgram
Source§fn clone(&self) -> HessianProgram
fn clone(&self) -> HessianProgram
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for HessianProgram
impl RefUnwindSafe for HessianProgram
impl Send for HessianProgram
impl Sync for HessianProgram
impl Unpin for HessianProgram
impl UnsafeUnpin for HessianProgram
impl UnwindSafe for HessianProgram
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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