Skip to main content

ScatteringInterpolationTable

Struct ScatteringInterpolationTable 

pub struct ScatteringInterpolationTable { /* private fields */ }
Expand description

Precomputed scattering matrices at log-spaced pot positions.

At compile time, sweeps the pot through K positions and computes full-precision scattering matrices. At runtime, binary search + linear interpolation replaces O(n³) matrix inversion with O(n²) lerp.

Implementations§

§

impl ScatteringInterpolationTable

pub fn build( mna: &MnaSystem, pot_node_pos: Option<usize>, pot_node_neg: Option<usize>, initial_g: f64, r_min: f64, r_max: f64, ports: &[WdfPort], vs_idx: Option<usize>, k: usize, ) -> ScatteringInterpolationTable

Build a table by sweeping the pot through K log-spaced positions.

  • mna: base MNA system (pot already stamped at initial_g)
  • pot_node_pos, pot_node_neg: MNA node indices for the pot
  • initial_g: current pot conductance stamped in the MNA G matrix
  • r_min, r_max: pot resistance range (typically 1.0 to max_resistance)
  • ports: WDF port definitions (reactive ports, no pot port)
  • vs_idx: voltage source index for VS injection (None for standard mode)
  • k: number of table entries

pub fn lookup(&self, pot_resistance: f64) -> (Vec<f64>, Vec<f64>)

Look up scattering matrix and VS injection vector by interpolating in log-resistance space. Returns (scattering, vs_injection).

pub fn has_vs_injection(&self) -> bool

Returns true when VS injection vectors are non-trivial (any entry != 0).

pub fn resistances(&self) -> &[f64]

Log-spaced resistance samples (ascending).

pub fn matrices(&self) -> &[Vec<f64>]

Scattering matrices, one per resistance sample, each n_ports² entries.

pub fn injections(&self) -> &[Vec<f64>]

VS injection vectors, one per resistance sample, each n_ports entries.

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more