pub struct IterativeResidual {
operator: Arc<IterativeSphereCluster>,
incident: DMatrix<Complex>,
options: GmresOptions,
solution: IterativeSolution,
}Expand description
What IterativeSphereCluster::record saves for its pullback: the shared
cluster, the incident fields, the GMRES options and the solution.
Fields§
§operator: Arc<IterativeSphereCluster>§incident: DMatrix<Complex>§options: GmresOptions§solution: IterativeSolutionImplementations§
Source§impl IterativeResidual
impl IterativeResidual
Sourcepub const fn solution(&self) -> &IterativeSolution
pub const fn solution(&self) -> &IterativeSolution
The forward solution and its convergence certificates; the pullback reads the solution.
Sourcepub fn shape(&self) -> (usize, usize)
pub fn shape(&self) -> (usize, usize)
The shape of the solution: local multipoles and incident columns.
Sourcefn response(&self) -> Result<DMatrix<Complex>>
fn response(&self) -> Result<DMatrix<Complex>>
The exciting field B + C X, shared by both derivative directions. Reuse
the coupling action’s output allocation without copying saved incident data.
Sourcepub fn pushforward(
&self,
k0: f64,
radii: &[f64],
epsilon: &[Complex],
positions: &[[f64; 3]],
incident: &DMatrix<Complex>,
) -> Result<IterativeSolution>
pub fn pushforward( &self, k0: f64, radii: &[f64], epsilon: &[Complex], positions: &[[f64; 3]], incident: &DMatrix<Complex>, ) -> Result<IterativeSolution>
Differentiate the converged equation, retaining the matrix-free operator:
(I - T C) dX = dT (B + C X) + T (dB + dC X).
Tangent and adjoint solves use relative-only convergence: the primal rtol,
or the default 1e-10 if it was zero. The primal atol applies only to the
primal solve, so small directions retain their relative accuracy. Restart
and iteration limits are unchanged, and each solve returns an independent
residual certificate. No Krylov history is retained or differentiated.
Sourcepub fn pullback(
&self,
cotangent: &DMatrix<Complex>,
) -> Result<IterativeGradient>
pub fn pullback( &self, cotangent: &DMatrix<Complex>, ) -> Result<IterativeGradient>
Gradients of the cluster and the incident fields from cotangent, the gradient
of a real loss with respect to the solution.
One adjoint GMRES solve per column gives Y = (I - T C)⁻ᴴ G; each particle pair
then contributes to the position and k0 gradients. Those contributions add in
chunks of particles fixed by the particle count, and the chunk sums in chunk
order; the radius and permittivity gradients add in particle order. The thread
count changes none of the gradients.
Convergence follows the same relative-only policy as Self::pushforward.
Trait Implementations§
Source§impl Debug for IterativeResidual
impl Debug for IterativeResidual
Source§impl SavedState for IterativeResidual
impl SavedState for IterativeResidual
Auto Trait Implementations§
impl Freeze for IterativeResidual
impl RefUnwindSafe for IterativeResidual
impl Send for IterativeResidual
impl Sync for IterativeResidual
impl Unpin for IterativeResidual
impl UnwindSafe for IterativeResidual
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.