Function multi_port_nr_solve
pub fn multi_port_nr_solve(
n_nl: usize,
s_nl: &[f64],
known_a: &[f64],
port_resistances: &[f64],
devices: &[&dyn NlDeviceIv],
v_guess: &mut [f64],
max_iter: usize,
tolerance: f64,
) -> Vec<f64>Expand description
Multi-port Newton-Raphson solver for coupled nonlinear WDF elements.
For N nonlinear ports on an R-type adaptor, the system of equations is:
F_i(v) = known_a_i + Σ_j S_nl[i][j]·(-2·R_j·i_j(v_j)) - 2·v_i = 0where known_a[i] includes contributions from all passive/adapted ports,
and S_nl is the NL-to-NL sub-block of the scattering matrix.
The Jacobian is:
J[i][j] = S_nl[i][j]·(-2·R_j)·(di_j/dv_j) for j ≠ i
J[i][i] = S_nl[i][i]·(-2·R_i)·(di_i/dv_i) - 2 for j = i§Parameters
n_nl: Number of coupled nonlinear portss_nl: NL-to-NL scattering sub-block (n_nl × n_nl, row-major)known_a: Pre-computed incident wave contributions from passive ports (n_nl)port_resistances: Port resistance for each NL port (n_nl)devices: NL device I-V evaluators (n_nl)v_guess: Warm-start voltages, mutated to final solution (n_nl)max_iter: Maximum Newton-Raphson iterationstolerance: Convergence threshold for |dv|
§Returns
Reflected wave b[i] for each NL port.