interpolate_network_data

pmrf.models.adapters.static.interpolate_network_data(f_old: Array, f_new: Array, data_old: Array) → Array

Linearly interpolate network data onto a new frequency grid.

Every port pair shares one interval lookup and one gather, so the traced program has the same size at any port count. Linear interpolation of a complex value is the same as interpolating its real and imaginary parts independently.

Mathematical Formulation

For \(f_k \le f \le f_{k+1}\),

\[X(f) = X_k + \frac{f - f_k}{f_{k+1} - f_k}\,(X_{k+1} - X_k),\]

and \(X(f)\) is NaN for \(f\) outside \([f_0, f_{N-1}]\).

Parameters:
  • f_old (jnp.ndarray) – The increasing source frequencies, shape (N,).

  • f_new (jnp.ndarray) – The requested frequencies, shape (M,).

  • data_old (jnp.ndarray) – The source matrices, shape (N, n_ports, n_ports).

Returns:

The interpolated matrices, shape (M, n_ports, n_ports).

Return type:

jnp.ndarray