sun_diffusion.linalg module¶
Utilities for basic linear algebra operations.
- sun_diffusion.linalg.trace(mtrx, dim1=-1, dim2=-2)¶
Computes the trace of a batched matrix mtrx along a chosen pair of dimensions (dim1, dim2).
Warning
By default, trace does NOT preserve the dimensionality of the matrix.
- Parameters:
mtrx (Tensor, NDArray) – Matrix to be traced
dim1 (int) – First dimension over which to trace
dim2 (int) – Second dimension over which to trace
- Return type:
Tensor|ndarray[tuple[int,...],dtype[TypeVar(_ScalarType_co, bound=generic, covariant=True)]]- Returns:
Array with elements along the diagonal of (dim1, dim2) summed
- sun_diffusion.linalg.transpose(mtrx, dim1=-1, dim2=-2)¶
Transposes a matrix mtrx by swapping a chosen pair of dimensions given by (dim1, dim2).
- Parameters:
mtrx (Tensor, NDArray) – Matrix to transpose
dim1 (int) – First dimension in transpose pair
dim2 (int) – Dimension to swap with dim1
- Return type:
Tensor|ndarray[tuple[int,...],dtype[TypeVar(_ScalarType_co, bound=generic, covariant=True)]]- Returns:
Transposed matrix
- sun_diffusion.linalg.adjoint(U)¶
Computes the Hermitian adjoint of a complex-valued matrix U, which is defined mathematically defined as the complex conjugate transpose:
\[U^\dagger = (U^*)^\top\]- Parameters:
U (Tensor, NDArray) – Complex matrix
- Return type:
Tensor|ndarray[tuple[int,...],dtype[TypeVar(_ScalarType_co, bound=generic, covariant=True)]]- Returns:
Hermitian adjoint of U