pub struct PreparedStructuralPhase { /* private fields */ }Expand description
Reusable, application-neutral structural phase with an owned worker budget.
Implementations§
Source§impl PreparedStructuralPhase
impl PreparedStructuralPhase
Sourcepub fn new(
definition: StructuralPhaseDefinition,
execution: ExecutionContext,
) -> Result<Self, StructuralPatternError>
pub fn new( definition: StructuralPhaseDefinition, execution: ExecutionContext, ) -> Result<Self, StructuralPatternError>
Validate and take ownership of one structural phase.
§Errors
Returns StructuralPatternError when reflection/site arrays disagree,
fixed offsets are invalid, or a scattering-table key is unknown.
Sourcepub fn reflection_count(&self) -> usize
pub fn reflection_count(&self) -> usize
Return the number of prepared reflections.
Sourcepub fn structural_parameter_count(&self) -> usize
pub fn structural_parameter_count(&self) -> usize
Return the structural parameter count in the native derivative layout.
Sourcepub fn execution_threads(&self) -> usize
pub fn execution_threads(&self) -> usize
Return the exact worker budget owned by this prepared phase.
Sourcepub const fn definition(&self) -> &StructuralPhaseDefinition
pub const fn definition(&self) -> &StructuralPhaseDefinition
Borrow the validated owned structural definition.
Sourcepub fn calculate(
&self,
input: &PreparedStructuralPatternInputView<'_>,
) -> Result<StructuralPatternResult, StructuralPatternError>
pub fn calculate( &self, input: &PreparedStructuralPatternInputView<'_>, ) -> Result<StructuralPatternResult, StructuralPatternError>
Calculate values for the prepared phase.
§Errors
Returns StructuralPatternError for invalid dynamic or structural
inputs.
Sourcepub fn linearize(
&self,
input: &PreparedStructuralPatternInputView<'_>,
) -> Result<StructuralPatternDenseResult, StructuralPatternError>
pub fn linearize( &self, input: &PreparedStructuralPatternInputView<'_>, ) -> Result<StructuralPatternDenseResult, StructuralPatternError>
Calculate values and a dense structural-pattern linearization.
§Errors
Returns StructuralPatternError for invalid dynamic or structural
inputs.
Sourcepub fn jvp(
&self,
input: &PreparedStructuralPatternInputView<'_>,
tangent: &[f64],
) -> Result<StructuralPatternJvpResult, StructuralPatternError>
pub fn jvp( &self, input: &PreparedStructuralPatternInputView<'_>, tangent: &[f64], ) -> Result<StructuralPatternJvpResult, StructuralPatternError>
Calculate values and a structural forward derivative product.
§Errors
Returns StructuralPatternError for invalid inputs or tangent shape.
Sourcepub fn vjp(
&self,
input: &PreparedStructuralPatternInputView<'_>,
sample_weights: &[f64],
) -> Result<StructuralPatternVjpResult, StructuralPatternError>
pub fn vjp( &self, input: &PreparedStructuralPatternInputView<'_>, sample_weights: &[f64], ) -> Result<StructuralPatternVjpResult, StructuralPatternError>
Calculate values and a pattern-Jacobian transpose product.
§Errors
Returns StructuralPatternError for invalid inputs or sample weights.
Trait Implementations§
Source§impl Clone for PreparedStructuralPhase
impl Clone for PreparedStructuralPhase
Source§fn clone(&self) -> PreparedStructuralPhase
fn clone(&self) -> PreparedStructuralPhase
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 !RefUnwindSafe for PreparedStructuralPhase
impl !UnwindSafe for PreparedStructuralPhase
impl Freeze for PreparedStructuralPhase
impl Send for PreparedStructuralPhase
impl Sync for PreparedStructuralPhase
impl Unpin for PreparedStructuralPhase
impl UnsafeUnpin for PreparedStructuralPhase
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,
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