pub struct QmatResidual {
destination: Vec<Mode>,
source: Vec<Mode>,
surface: Surface,
ks: [[Complex; 2]; 2],
zs: [Complex; 2],
radial: Radial,
radial_area_factor: bool,
}Expand description
What qmat saves for its pullback: the modes, the surface and the media, without
any wave values; the pullback evaluates the waves again.
Fields§
§destination: Vec<Mode>§source: Vec<Mode>§surface: Surface§ks: [[Complex; 2]; 2]§zs: [Complex; 2]§radial: Radial§radial_area_factor: boolImplementations§
Source§impl QmatResidual
impl QmatResidual
fn validate(&self) -> Result<()>
Sourcepub fn state_size(
samples: usize,
destinations: usize,
sources: usize,
) -> Result<usize>
pub fn state_size( samples: usize, destinations: usize, sources: usize, ) -> Result<usize>
Bytes in the private callback state for the quadrature and mode counts.
Sourcefn wave_sets(&self) -> Result<[WaveSet; 2]>
fn wave_sets(&self) -> Result<[WaveSet; 2]>
The inner test waves, whose orders are reversed, and the outer waves.
Sourcefn weight(&self, node: usize) -> f64
fn weight(&self, node: usize) -> f64
Integration weight of a node: the quadrature weight, sin(theta) and, with
radial_area_factor, the radius.
Sourcefn measure(&self, node: usize) -> f64
fn measure(&self, node: usize) -> f64
The quadrature weight times sin(theta), which does not depend on the radius.
Sourcefn rows_by_order(&self) -> HashMap<i32, Vec<usize>>
fn rows_by_order(&self) -> HashMap<i32, Vec<usize>>
The rows of each azimuthal order; only equal orders couple.
Sourcefn factors(&self) -> [[Complex; 2]; 2]
fn factors(&self) -> [[Complex; 2]; 2]
The impedance factor HELICITY[a] z_outer + HELICITY[b] z_inner of each (row
helicity a, column helicity b) pair.
Sourcepub fn samples(&self) -> usize
pub fn samples(&self) -> usize
Number of fixed quadrature nodes, for binding-level tangent validation.
Sourcepub fn pushforward(
&self,
radii: &[f64],
slopes: &[f64],
ks: [[Complex; 2]; 2],
zs: [Complex; 2],
) -> Result<DMatrix<Complex>>
pub fn pushforward( &self, radii: &[f64], slopes: &[f64], ks: [[Complex; 2]; 2], zs: [Complex; 2], ) -> Result<DMatrix<Complex>>
Directional derivative with respect to the surface radii and slopes, wavenumbers and impedances. Quadrature nodes and weights stay fixed. Each wave’s local derivatives are contracted once per node, before the matrix entries are assembled, sharing the same cached waves as the pullback.
Sourcepub fn pullback(&self, cotangent: &DMatrix<Complex>) -> Result<QmatGradient>
pub fn pullback(&self, cotangent: &DMatrix<Complex>) -> Result<QmatGradient>
Gradients of the surface radii and slopes, the wavenumbers and the impedances
from cotangent, the gradient of a real loss with respect to the matrix. The
quadrature nodes and weights stay fixed. The sums run over the nodes in order,
so the gradients do not depend on the thread count.
Trait Implementations§
Source§impl Debug for QmatResidual
impl Debug for QmatResidual
Source§impl SavedState for QmatResidual
impl SavedState for QmatResidual
Auto Trait Implementations§
impl Freeze for QmatResidual
impl RefUnwindSafe for QmatResidual
impl Send for QmatResidual
impl Sync for QmatResidual
impl Unpin for QmatResidual
impl UnwindSafe for QmatResidual
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.