twpasolver.matrices_arrays module#

ABCD matrices array module.

twpasolver.matrices_arrays.matmul_2x2(a: ndarray, b: ndarray) → ndarray[source]#

Product of stacks of 2x2 matrices, shape (N, 2, 2); ~4x faster than np.matmul for large N.

class twpasolver.matrices_arrays.TwoByTwoArray(mat: ndarray)[source]#

Bases: object

A class representing an array of 2x2 matrices.

property shape#

Shape of the internal array.

property len#

Length of the internal array.

class twpasolver.matrices_arrays.ABCDArray(mat: ndarray)[source]#

Bases: TwoByTwoArray

A class representing an array of ABCD matrices.

A#

A (element (0,0)) of the 2x2 matrices.

B#

B (element (0,1)) of the 2x2 matrices.

C#

C (element (1,0)) of the 2x2 matrices.

D#

D (element (1,1)) of the 2x2 matrices.

class twpasolver.matrices_arrays.SMatrixArray(mat: ndarray)[source]#

Bases: TwoByTwoArray

A class representing an array of two-ports S parameters matrices.

S11#

S11 (element (0,0)) of the 2x2 matrices.

S12#

S12 (element (0,1)) of the 2x2 matrices.

S21#

S21 (element (1,0)) of the 2x2 matrices.

S22#

S22 (element (1,1)) of the 2x2 matrices.

class twpasolver.matrices_arrays.ZMatrixArray(mat: ndarray)[source]#

Bases: TwoByTwoArray

A class representing an array of two-ports Z parameters matrices.

Z11#

Z11 (element (0,0)) of the 2x2 matrices.

Z12#

Z12 (element (0,1)) of the 2x2 matrices.

Z21#

Z21 (element (1,0)) of the 2x2 matrices.

Z22#

Z22 (element (1,1)) of the 2x2 matrices.

twpasolver.matrices_arrays.abcd_identity(N_abcd: int) → ABCDArray[source]#

Get an ABCDArray of N_abcd identity matrices.