pub struct EigResidual {
values: Vec<Complex>,
vectors: DMatrix<Complex>,
pivots: Vec<usize>,
scale: f64,
vectors_lu: OnceLock<Result<Lu>>,
}Expand description
What eig saves for its derivatives: the right eigensystem, with unit vectors whose
largest component is real and positive.
Fields§
§values: Vec<Complex>§vectors: DMatrix<Complex>§pivots: Vec<usize>§scale: f64§vectors_lu: OnceLock<Result<Lu>>Factor the eigenvectors only when a derivative needs their inverse; every later direction and cotangent shares the same factors.
Implementations§
Source§impl EigResidual
impl EigResidual
Sourcepub fn state_size(n: usize) -> Result<usize>
pub fn state_size(n: usize) -> Result<usize>
Byte count for the native saved state of an n × n eigensystem.
Source§impl EigResidual
impl EigResidual
fn vectors_lu(&self) -> Result<&Lu>
Sourcepub fn values(&self) -> &[Complex] ⓘ
pub fn values(&self) -> &[Complex] ⓘ
The eigenvalues in the solver’s order, which the pullback reads.
Sourcepub const fn vectors(&self) -> &DMatrix<Complex>
pub const fn vectors(&self) -> &DMatrix<Complex>
The right eigenvectors, one column per eigenvalue, which the pullback reads.
Sourcefn tied_pivot(&self, column: usize) -> bool
fn tied_pivot(&self, column: usize) -> bool
Whether the phase pivot is tied with another largest component.
Sourcefn eigenbasis_tangent(
&self,
operator: &DMatrix<Complex>,
) -> Result<DMatrix<Complex>>
fn eigenbasis_tangent( &self, operator: &DMatrix<Complex>, ) -> Result<DMatrix<Complex>>
Express the perturbation in the eigenbasis; its diagonal is the eigenvalue derivative and its off-diagonal entries determine eigenvectors.
Sourcefn check_value_order(&self, weights: Option<&[Complex]>) -> Result<()>
fn check_value_order(&self, weights: Option<&[Complex]>) -> Result<()>
An ordered spectrum switches modes when real parts cross. Only equal loss weights across a tied group make that change irrelevant.
Sourcepub fn pushforward_values(
&self,
operator: &DMatrix<Complex>,
) -> Result<Vec<Complex>>
pub fn pushforward_values( &self, operator: &DMatrix<Complex>, ) -> Result<Vec<Complex>>
Eigenvalue tangents with no eigenvector phase constraint. Distinct real
parts keep eigvals’ ordering fixed; tied phase pivots are supported.
Sourcepub fn pullback_values(&self, values: &[Complex]) -> Result<DMatrix<Complex>>
pub fn pullback_values(&self, values: &[Complex]) -> Result<DMatrix<Complex>>
Pullback of eigvals, allowing equal weights at ordering ties.
Sourcepub fn pushforward(
&self,
operator: &DMatrix<Complex>,
) -> Result<(Vec<Complex>, DMatrix<Complex>)>
pub fn pushforward( &self, operator: &DMatrix<Complex>, ) -> Result<(Vec<Complex>, DMatrix<Complex>)>
Eigenpair tangents with the same unit norm and real-positive pivot phase as
the primal. Repeated eigenvalues and tied phase pivots have no pushforward of
the complete eigenpair output. Use Self::pushforward_values when only
eigenvalues are needed.
Sourcepub fn pullback(
&self,
values: &[Complex],
vectors: DMatrix<Complex>,
) -> Result<DMatrix<Complex>>
pub fn pullback( &self, values: &[Complex], vectors: DMatrix<Complex>, ) -> Result<DMatrix<Complex>>
The operator gradient from the eigenvalue and eigenvector cotangents, with the phase of each vector fixed at its pivot.
Repeated eigenvalues support equal eigenvalue weights and zero vector cotangents within each repeated group. Individual modes there have no pullback.
Trait Implementations§
Source§impl Debug for EigResidual
impl Debug for EigResidual
Source§impl SavedState for EigResidual
impl SavedState for EigResidual
Auto Trait Implementations§
impl !Freeze for EigResidual
impl RefUnwindSafe for EigResidual
impl Send for EigResidual
impl Sync for EigResidual
impl Unpin for EigResidual
impl UnwindSafe for EigResidual
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 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>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.