pub(crate) struct TranslationPlan {
terms: Vec<Term>,
starts: Vec<usize>,
lmax: i32,
solids: SolidTable,
}Expand description
Geometry-independent spherical mode couplings, shared across position pairs.
Fields§
§terms: Vec<Term>Terms of all entries, entry e in terms[starts[e]..starts[e + 1]].
starts: Vec<usize>§lmax: i32Largest harmonic degree: the largest destination plus the largest source degree.
solids: SolidTableImplementations§
Source§impl TranslationPlan
impl TranslationPlan
Sourcepub(crate) fn between(
destination: &[Mode],
source: &[Mode],
helicity: bool,
) -> Result<Self>
pub(crate) fn between( destination: &[Mode], source: &[Mode], helicity: bool, ) -> Result<Self>
The couplings from the source modes to the destination modes, in helicity or
parity polarization.
Sourcepub(crate) fn weights_for_normalized_harmonics(&mut self)
pub(crate) fn weights_for_normalized_harmonics(&mut self)
Divide each weight by the normalization N_pm of its harmonic
(crate::special::harmonic_normalization). The plan then sums its weights
against tables of orthonormal-harmonic values N_pm z_p P_p^m e^(i m phi), the
normalization of the lattice sums of crate::lattice::sum, instead of
z_p P_p^m e^(i m phi).
Sourcefn entries(&self) -> impl Iterator<Item = &[Term]>
fn entries(&self) -> impl Iterator<Item = &[Term]>
The terms of each block entry, column-major (source outer, destination inner).
Sourcepub(crate) fn evaluate_table(&self, table: &[Complex]) -> Vec<Complex> ⓘ
pub(crate) fn evaluate_table(&self, table: &[Complex]) -> Vec<Complex> ⓘ
The block, column-major, from harmonic values table at index p * p + p + m.
Sourcepub(crate) fn pullback_table(
&self,
cotangent: &[Complex],
table: &mut [Complex],
)
pub(crate) fn pullback_table( &self, cotangent: &[Complex], table: &mut [Complex], )
Add the block cotangent, weighted by the conjugate term weights, to the harmonic
cotangents table.
Sourcefn radials(&self, z: Complex, radial: Radial) -> Result<Vec<RadialJet>>
fn radials(&self, z: Complex, radial: Radial) -> Result<Vec<RadialJet>>
Radial jets z_p(z) of degrees p = 0..=lmax.
Sourcefn values(
&self,
k: Complex,
position: [f64; 3],
radial: Radial,
) -> Result<Vec<Complex>>
fn values( &self, k: Complex, position: [f64; 3], radial: Radial, ) -> Result<Vec<Complex>>
Harmonic table z_p(k r) P_p^m(cos theta) e^(i m phi) at index p * p + p + m.
Outgoing waves vanish at the origin, where only the regular p = 0 term survives.
Sourcefn table(
&self,
k: Complex,
position: [f64; 3],
radial: Radial,
) -> Result<Vec<CartesianTranslation>>
fn table( &self, k: Complex, position: [f64; 3], radial: Radial, ) -> Result<Vec<CartesianTranslation>>
Harmonic table with the displacement and wavenumber derivatives of each entry.
Sourcepub(crate) fn evaluate(
&self,
k: Complex,
position: [f64; 3],
radial: Radial,
) -> Result<Vec<Complex>>
pub(crate) fn evaluate( &self, k: Complex, position: [f64; 3], radial: Radial, ) -> Result<Vec<Complex>>
The block of regular or singular translation coefficients at the displacement
position, column-major (source outer, destination inner).
Sourcepub(crate) fn apply(
&self,
k: Complex,
position: [f64; 3],
radial: Radial,
input: MatRef<'_, Complex>,
output: MatMut<'_, Complex>,
adjoint: bool,
) -> Result<()>
pub(crate) fn apply( &self, k: Complex, position: [f64; 3], radial: Radial, input: MatRef<'_, Complex>, output: MatMut<'_, Complex>, adjoint: bool, ) -> Result<()>
Add the translation applied to input to output, sharing each coefficient
across the input columns without storing a dense block. With adjoint, apply
its conjugate transpose instead. The row counts follow the plan’s source and
destination modes, exchanged for the adjoint.
Sourcepub(crate) fn apply_pushforward(
&self,
k: Complex,
position: [f64; 3],
radial: Radial,
position_tangent: [f64; 3],
k_tangent: Complex,
input: MatRef<'_, Complex>,
output: MatMut<'_, Complex>,
) -> Result<()>
pub(crate) fn apply_pushforward( &self, k: Complex, position: [f64; 3], radial: Radial, position_tangent: [f64; 3], k_tangent: Complex, input: MatRef<'_, Complex>, output: MatMut<'_, Complex>, ) -> Result<()>
Apply the directional derivative of a translation directly to its incident columns, without allocating a dense particle-pair block.
Sourcefn apply_table(
&self,
table: &[Complex],
input: MatRef<'_, Complex>,
output: MatMut<'_, Complex>,
adjoint: bool,
)
fn apply_table( &self, table: &[Complex], input: MatRef<'_, Complex>, output: MatMut<'_, Complex>, adjoint: bool, )
A value or tangent harmonic table, shared over all incident columns.
Sourcefn harmonic_groups(&self, workers: usize) -> Vec<(i32, RangeInclusive<i32>)>
fn harmonic_groups(&self, workers: usize) -> Vec<(i32, RangeInclusive<i32>)>
Cache-sharing groups in harmonic order. Whole degrees retain the most reuse; when a block has more workers than degrees, consecutive orders expose enough independent work to use that budget. Grouping changes no harmonic’s arithmetic.
Sourcepub(crate) fn evaluate_periodic(
&self,
k: Complex,
position: [f64; 3],
lattice: &BlochLattice,
eta: Complex,
workers: usize,
) -> Result<Vec<Complex>>
pub(crate) fn evaluate_periodic( &self, k: Complex, position: [f64; 3], lattice: &BlochLattice, eta: Complex, workers: usize, ) -> Result<Vec<Complex>>
The block of lattice-summed couplings at the displacement position
(destination minus source). The lattice sums take source - destination.
Sourcepub(crate) fn pushforward_periodic(
&self,
ks: [Complex; 2],
position: [f64; 3],
lattice: &BlochLattice,
eta: Complex,
tangents: &[SumTangent; 2],
workers: usize,
) -> Result<[Vec<Complex>; 2]>
pub(crate) fn pushforward_periodic( &self, ks: [Complex; 2], position: [f64; 3], lattice: &BlochLattice, eta: Complex, tangents: &[SumTangent; 2], workers: usize, ) -> Result<[Vec<Complex>; 2]>
Apply the angular plan to directional lattice-sum derivatives. Equal medium wavenumbers share their Ewald jets even when their input directions differ.
Sourcepub(crate) fn pullback_periodic(
&self,
ks: [Complex; 2],
position: [f64; 3],
lattice: &BlochLattice,
eta: Complex,
cotangent: &[Vec<Complex>; 2],
workers: usize,
) -> Result<[SumGradient; 2]>
pub(crate) fn pullback_periodic( &self, ks: [Complex; 2], position: [f64; 3], lattice: &BlochLattice, eta: Complex, cotangent: &[Vec<Complex>; 2], workers: usize, ) -> Result<[SumGradient; 2]>
The lattice-sum gradients of the block cotangents of both polarizations.
Cache-sharing groups adapt to the worker budget, but their gradients are collected and added in harmonic order, so the thread count does not change them.
Sourcepub(crate) fn pushforward(
&self,
k: Complex,
position: [f64; 3],
radial: Radial,
position_tangent: [f64; 3],
k_tangent: Complex,
) -> Result<Vec<Complex>>
pub(crate) fn pushforward( &self, k: Complex, position: [f64; 3], radial: Radial, position_tangent: [f64; 3], k_tangent: Complex, ) -> Result<Vec<Complex>>
Contract the shared harmonic derivatives before assembling the block.
Trait Implementations§
Source§impl Clone for TranslationPlan
impl Clone for TranslationPlan
Source§fn clone(&self) -> TranslationPlan
fn clone(&self) -> TranslationPlan
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 TranslationPlan
impl RefUnwindSafe for TranslationPlan
impl Send for TranslationPlan
impl Sync for TranslationPlan
impl Unpin for TranslationPlan
impl UnwindSafe for TranslationPlan
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.