pub struct PreparedGeneralFreeLinearization { /* private fields */ }Expand description
Complete weighted Jacobian in scaled free-parameter coordinates.
Rows are free parameters and columns are pattern samples. Masked samples are zero and included samples are divided by their uncertainty when the objective uses uncertainty weighting. This matches the dense scripting optimizer contract, so its JVP and VJP need no further weighting.
Implementations§
Source§impl PreparedGeneralFreeLinearization
impl PreparedGeneralFreeLinearization
Sourcepub const fn calculation(&self) -> &RietveldCalculation
pub const fn calculation(&self) -> &RietveldCalculation
Borrow the calculation produced by the same fused native pass.
Sourcepub const fn parameter_count(&self) -> usize
pub const fn parameter_count(&self) -> usize
Return the scaled free-parameter count.
Sourcepub fn jvp(
&self,
direction: &[f64],
) -> Result<Vec<f64>, RietveldGeneralObjectiveError>
pub fn jvp( &self, direction: &[f64], ) -> Result<Vec<f64>, RietveldGeneralObjectiveError>
Apply the weighted free Jacobian.
§Errors
Returns RietveldGeneralParameterError::ValueLengthMismatch for a
direction with the wrong free dimension.
Sourcepub fn vjp(
&self,
samples: &[f64],
) -> Result<Vec<f64>, RietveldGeneralObjectiveError>
pub fn vjp( &self, samples: &[f64], ) -> Result<Vec<f64>, RietveldGeneralObjectiveError>
Apply the weighted free Jacobian transpose.
§Errors
Returns RietveldGeneralObjectiveError::SampleLengthMismatch for a
vector with the wrong sample dimension.
Sourcepub fn normal_product(
&self,
direction: &[f64],
damping: f64,
) -> Result<Vec<f64>, RietveldGeneralObjectiveError>
pub fn normal_product( &self, direction: &[f64], damping: f64, ) -> Result<Vec<f64>, RietveldGeneralObjectiveError>
Return J_w^T J_w direction + damping direction in scaled free coordinates.
§Errors
Returns RietveldGeneralObjectiveError for invalid damping or shape.
Sourcepub fn gradient(
&self,
observed: &[f64],
) -> Result<Vec<f64>, RietveldGeneralObjectiveError>
pub fn gradient( &self, observed: &[f64], ) -> Result<Vec<f64>, RietveldGeneralObjectiveError>
Calculate the scaled free gradient for the stored calculation.
§Errors
Returns RietveldGeneralObjectiveError::SampleLengthMismatch for an
observed vector with the wrong sample dimension.
Auto Trait Implementations§
impl Freeze for PreparedGeneralFreeLinearization
impl RefUnwindSafe for PreparedGeneralFreeLinearization
impl Send for PreparedGeneralFreeLinearization
impl Sync for PreparedGeneralFreeLinearization
impl Unpin for PreparedGeneralFreeLinearization
impl UnsafeUnpin for PreparedGeneralFreeLinearization
impl UnwindSafe for PreparedGeneralFreeLinearization
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.