pub struct MetricResidual {
gradient: Result<DMatrix<Complex>>,
ks_gradient: [f64; 2],
dimension: usize,
}Expand description
What metric saves for its pullback: the gradient itself, since the value is a
real scalar; no singular vectors are kept.
Fields§
§gradient: Result<DMatrix<Complex>>The matrix gradient, or why it is undefined: chirality may be zero where its derivative is undefined.
ks_gradient: [f64; 2]§dimension: usizeImplementations§
Source§impl MetricResidual
impl MetricResidual
Sourcepub fn state_size(dimension: usize) -> Result<usize>
pub fn state_size(dimension: usize) -> Result<usize>
Number of bytes in the fixed derivative state for a square metric input.
Source§impl MetricResidual
impl MetricResidual
Sourcepub fn pushforward(
&self,
matrix: &DMatrix<Complex>,
ks: [f64; 2],
) -> Result<f64>
pub fn pushforward( &self, matrix: &DMatrix<Complex>, ks: [f64; 2], ) -> Result<f64>
The real metric tangent, from the saved scalar gradient and changes of the T-matrix and embedding wavenumbers, using the real complex inner product.
Sourcepub fn pullback(&self, cotangent: f64) -> Result<MetricGradient>
pub fn pullback(&self, cotangent: f64) -> Result<MetricGradient>
Gradients of the matrix and the embedding wavenumbers from cotangent, the
gradient of a real loss with respect to the metric.
The pullback scales the saved gradient on the calling thread, so the Rayon pool does not change it.
Trait Implementations§
Source§impl Debug for MetricResidual
impl Debug for MetricResidual
Source§impl SavedState for MetricResidual
impl SavedState for MetricResidual
Auto Trait Implementations§
impl Freeze for MetricResidual
impl RefUnwindSafe for MetricResidual
impl Send for MetricResidual
impl Sync for MetricResidual
impl Unpin for MetricResidual
impl UnwindSafe for MetricResidual
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> 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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.