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>) -> Self
pub fn compile(tape: &Tape, hess_map: &HashMap<(usize, usize), usize>) -> 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.
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
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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