cascade_two_s
- pmrf.rf.cascade_two_s(s_a: Array | ndarray | bool | number | bool | int | float | complex, z0_a: Array | ndarray | bool | number | bool | int | float | complex, s_b: Array | ndarray | bool | number | bool | int | float | complex, z0_b: Array | ndarray | bool | number | bool | int | float | complex) tuple[Array, Array]
Combine two 2N-port S-parameter matrices connected end-to-end.
Ports \(N\) to \(2N-1\) of network \(A\) are connected to ports \(0\) to \(N-1\) of network \(B\). Both networks must share the same reference impedances across the connected interface; no renormalization is performed here.
Mathematical Formulation
Partitioning each network into \(N \times N\) blocks, the combined network is
\[S_{11} = A_{11} + A_{12} (I - B_{11} A_{22})^{-1} B_{11} A_{21}\]\[S_{12} = A_{12} (I - B_{11} A_{22})^{-1} B_{12}\]\[S_{21} = B_{21} (I - A_{22} B_{11})^{-1} A_{21}\]\[S_{22} = B_{22} + B_{21} (I - A_{22} B_{11})^{-1} A_{22} B_{12}\]Floating multi-conductor networks leave a common mode at the junction that makes \(M = I - B_{11} A_{22}\) singular in theory, but only to rounding in practice. Inverting it, or pseudo-inverting at any fixed cutoff, amplifies that rounding into S and its gradients. Such a direction \(y\) is also unobservable from the external ports, \(A_{12} y = 0\), so the cascade does not depend on it. With \(R\) an orthonormal basis of the directions where
\[\begin{split}\begin{bmatrix} M \\ A_{12} \end{bmatrix} y \approx 0,\end{split}\]judged by singular value relative to the largest, at a tolerance of \(\sqrt{\epsilon}\) for the dtype, the combine inverts \(M + R R^H\) exactly. The same applies to \(N = I - A_{22} B_{11}\) with \(B_{21}\). The basis is found outside autodiff, so gradients never pass through the zero singular values. A resonance is observable from the ports, so it is never pinned; for full-rank \(M\) this is the plain inverse.
A lossless network evaluated exactly at a true resonance frequency is still singular. That is physical, and the result there is not finite.
- Parameters:
s_a (ArrayLike) – S-parameter matrix of the first network, shape (2N, 2N).
z0_a (ArrayLike) – Port reference impedances of the first network, shape (2N,).
s_b (ArrayLike) – S-parameter matrix of the second network, shape (2N, 2N).
z0_b (ArrayLike) – Port reference impedances of the second network, shape (2N,).
- Returns:
s_cas (jnp.ndarray) – S-parameter matrix of the combined network, shape (2N, 2N).
z0_cas (jnp.ndarray) – Port reference impedances of the combined network, shape (2N,).
References