TranslationPlan

Struct TranslationPlan 

Source
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: i32

Largest harmonic degree: the largest destination plus the largest source degree.

§solids: SolidTable

Implementations§

Source§

impl TranslationPlan

Source

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.

Source

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).

Source

fn entries(&self) -> impl Iterator<Item = &[Term]>

The terms of each block entry, column-major (source outer, destination inner).

Source

pub(crate) fn evaluate_table(&self, table: &[Complex]) -> Vec<Complex> ⓘ

The block, column-major, from harmonic values table at index p * p + p + m.

Source

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.

Source

fn radials(&self, z: Complex, radial: Radial) -> Result<Vec<RadialJet>>

Radial jets z_p(z) of degrees p = 0..=lmax.

Source

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.

Source

fn table( &self, k: Complex, position: [f64; 3], radial: Radial, ) -> Result<Vec<CartesianTranslation>>

Harmonic table with the displacement and wavenumber derivatives of each entry.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn tangent_table( &self, k: Complex, position: [f64; 3], radial: Radial, position_tangent: [f64; 3], k_tangent: Complex, ) -> Result<Vec<Complex>>

Contract derivatives before expanding harmonic coefficients into mode pairs.

Source

pub(crate) fn pullback( &self, k: Complex, position: [f64; 3], radial: Radial, cotangent: &[Complex], ) -> Result<([f64; 3], Complex)>

Pull a block cotangent of evaluate back to the real displacement gradient and the complex wavenumber cotangent.

Trait Implementations§

Source§

impl Clone for TranslationPlan

Source§

fn clone(&self) -> TranslationPlan

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TranslationPlan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,