pub struct ExpansionResidual {
pub(super) basis: MultipoleBasis,
pub(super) vectors: Vec<[Complex; 3]>,
pub(super) polarizations: Vec<u8>,
pub(super) helicity: bool,
pub(super) fixed_vectors: bool,
}Expand description
What expansion saves for its pullback: its inputs. The pullback recomputes the
coefficients instead of keeping a Jacobian.
The pullback adds the per-mode position gradients in chunks of consecutive plane
modes fixed by the mode count, and the chunk sums in chunk order
(numerics::parallel::try_fold_ordered), so the thread count does not change them.
Each wavevector gradient belongs to one plane mode, which writes it in place.
Fields§
§basis: MultipoleBasis§vectors: Vec<[Complex; 3]>§polarizations: Vec<u8>§helicity: bool§fixed_vectors: boolImplementations§
Source§impl ExpansionResidual
impl ExpansionResidual
Sourcepub fn validate_tangents(
&self,
positions: &[[f64; 3]],
vectors: &[[Complex; 3]],
) -> Result<()>
pub fn validate_tangents( &self, positions: &[[f64; 3]], vectors: &[[Complex; 3]], ) -> Result<()>
Validate position and wavevector tangents for the recorded operation.
Sourcepub fn pushforward(
&self,
positions: &[[f64; 3]],
vectors: &[[Complex; 3]],
) -> Result<DMatrix<Complex>>
pub fn pushforward( &self, positions: &[[f64; 3]], vectors: &[[Complex; 3]], ) -> Result<DMatrix<Complex>>
Push a direction through the position phases and angular coefficients. Cylindrical axial components remain fixed mode labels, as in the pullback.
Sourcefn push_column<const N: usize>(
&self,
labels: &AngularLabels,
j: usize,
direction: &Direction<N>,
positions: &[[f64; 3]],
vectors: &[[Complex; 3]],
column: &mut [Complex],
)
fn push_column<const N: usize>( &self, labels: &AngularLabels, j: usize, direction: &Direction<N>, positions: &[[f64; 3]], vectors: &[[Complex; 3]], column: &mut [Complex], )
Evaluate and contract the same angular jets used by the reverse contraction.
Sourcepub fn pullback(
&self,
cotangent: &DMatrix<Complex>,
) -> Result<ExpansionGradient>
pub fn pullback( &self, cotangent: &DMatrix<Complex>, ) -> Result<ExpansionGradient>
Differentiate position phases and the full direction-dependent angular coefficient.
Sourcefn contract<const N: usize>(
&self,
labels: &AngularLabels,
j: usize,
direction: &Direction<N>,
cotangent: &DMatrix<Complex>,
positions: &mut [[f64; 3]],
vector_gradient: &mut [Complex; 3],
)
fn contract<const N: usize>( &self, labels: &AngularLabels, j: usize, direction: &Direction<N>, cotangent: &DMatrix<Complex>, positions: &mut [[f64; 3]], vector_gradient: &mut [Complex; 3], )
Add the gradients of column j to the position gradients positions and, with
direction derivatives (N > 0), to its wavevector gradient vector_gradient.
Trait Implementations§
Source§impl Debug for ExpansionResidual
impl Debug for ExpansionResidual
Source§impl SavedState for ExpansionResidual
impl SavedState for ExpansionResidual
Auto Trait Implementations§
impl Freeze for ExpansionResidual
impl RefUnwindSafe for ExpansionResidual
impl Send for ExpansionResidual
impl Sync for ExpansionResidual
impl Unpin for ExpansionResidual
impl UnwindSafe for ExpansionResidual
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.