pub struct InteractionFactor {
local: LocalMatrix,
coupling: DMatrix<Complex>,
lu: Lu,
}Expand description
The LU factorization of I - T C, kept with the local T-matrix T and the
coupling C, for any number of incident-field solves.
A block-diagonal T stays a list of particle blocks; it is never expanded to a
dense matrix. record shares the factor through an Arc, so
every recorded solve keeps only its own incident and scattered fields.
treams-rs extension. treams solves the full system once with
TMatrix.interaction.solve(); interaction computes that result.
Fields§
§local: LocalMatrix§coupling: DMatrix<Complex>§lu: LuImplementations§
Source§impl InteractionFactor
impl InteractionFactor
Sourcepub fn new(local: DMatrix<Complex>, coupling: DMatrix<Complex>) -> Result<Self>
pub fn new(local: DMatrix<Complex>, coupling: DMatrix<Complex>) -> Result<Self>
Factor I - T C for a dense local matrix T.
Sourcepub fn from_blocks(
local: Vec<DMatrix<Complex>>,
coupling: DMatrix<Complex>,
) -> Result<Self>
pub fn from_blocks( local: Vec<DMatrix<Complex>>, coupling: DMatrix<Complex>, ) -> Result<Self>
Factor I - T C for a block-diagonal T given by its particle blocks.
fn factorize(local: LocalMatrix, coupling: DMatrix<Complex>) -> Result<Self>
Sourcepub fn solve(&self, incident: &DMatrix<Complex>) -> Result<DMatrix<Complex>>
pub fn solve(&self, incident: &DMatrix<Complex>) -> Result<DMatrix<Complex>>
Solve (I - T C) scattered = T incident for only the supplied columns.
Sourcepub fn pullback_incident(
&self,
cotangent: &DMatrix<Complex>,
) -> Result<DMatrix<Complex>>
pub fn pullback_incident( &self, cotangent: &DMatrix<Complex>, ) -> Result<DMatrix<Complex>>
Gradient of incident columns for a fixed factor: Tᴴ (I - T C)⁻ᴴ G.
This borrows the saved LU and needs no incident or scattered fields.
Sourcepub fn record(
self: &Arc<Self>,
incident: DMatrix<Complex>,
) -> Result<IlluminateResidual>
pub fn record( self: &Arc<Self>, incident: DMatrix<Complex>, ) -> Result<IlluminateResidual>
Solve like solve and keep B + C X for both derivative
directions. This response replaces the incident fields, and the residual
shares this factor. Use solve when only the scattered fields are needed.
Sourcefn solve_system(&self, rhs: DMatrix<Complex>) -> Result<DMatrix<Complex>>
fn solve_system(&self, rhs: DMatrix<Complex>) -> Result<DMatrix<Complex>>
(I - T C)⁻¹ rhs; a non-finite solution means a numerically singular operator.
fn validate(&self, values: &DMatrix<Complex>) -> Result<()>
fn validate_tangents( &self, local: &[DMatrix<Complex>], coupling: &DMatrix<Complex>, ) -> Result<()>
Trait Implementations§
Source§impl Clone for InteractionFactor
impl Clone for InteractionFactor
Source§fn clone(&self) -> InteractionFactor
fn clone(&self) -> InteractionFactor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for InteractionFactor
impl RefUnwindSafe for InteractionFactor
impl Send for InteractionFactor
impl Sync for InteractionFactor
impl Unpin for InteractionFactor
impl UnwindSafe for InteractionFactor
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§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.