Skip to main content

EvaluatedGradientState

Trait EvaluatedGradientState 

Source
pub trait EvaluatedGradientState: EvaluatedState {
    // Required method
    fn current_gradient_record(
        &self,
    ) -> Option<(&Self::Param, Self::Float, &Self::Param)>;
}
Expand description

Checked access to a complete current point, cost, and gradient.

Availability must agree with EvaluatedState::current_record. A numerical check requiring a gradient must handle an unavailable record explicitly, rather than silently disabling itself. Attach publication validation to reject incomplete records before checks or observers run.

A point-only state does not supply this capability:

use basin::{EvaluatedGradientState, PointState};
fn gradient_check<S: EvaluatedGradientState>(_: &S) {}
gradient_check(&PointState::new(vec![1.0]));

Required Methods§

Source

fn current_gradient_record( &self, ) -> Option<(&Self::Param, Self::Float, &Self::Param)>

Borrow the matching point, cost, and gradient, or None for a seed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§