ffsim.linalg.logm_unitary

ffsim.linalg.logm_unitary(mat)[source]

Compute the principal matrix logarithm of a unitary matrix.

The logarithm is computed from the Schur decomposition, which for a unitary matrix takes the form mat = vecs @ diag(eigs) @ vecs.conj().T, where vecs is unitary and the eigenvalues eigs lie on the unit circle. The logarithm is obtained by replacing each eigenvalue with the imaginary number given by its phase.

This is faster than the general-purpose scipy.linalg.logm(), and unlike that function it returns an antihermitian matrix by construction.

Parameters:

mat (ndarray) – The unitary matrix.

Return type:

ndarray

Returns:

The antihermitian principal matrix logarithm of the unitary matrix.