matrix_props.commutant

Module for computing the commutant of a set of matrices.

Functions

commutant(A)

Compute an orthonormal basis for the commutant algebra [2].

Module Contents

matrix_props.commutant.commutant(A)

Compute an orthonormal basis for the commutant algebra [2].

Given a matrix \(A\) or a set of matrices \(\mathcal{A} = \{A_1, A_2, \dots\}\), this function determines an orthonormal basis (with respect to the Hilbert-Schmidt inner product) for the algebra of matrices that commute with every matrix in \(\mathcal{A}\).

The commutant of a single matrix \(A \in \mathbb{C}^{n \times n}\) consists of all matrices \(X \in \mathbb{C}^{n \times n}\) satisfying:

\[A X = X A.\]

More generally, for a set of matrices \(\mathcal{A} = \{A_1, A_2, \dots\}\), the commutant consists of all matrices \(X\) satisfying:

\[A_i X = X A_i \quad \forall A_i \in \mathcal{A}.\]

This condition can be rewritten in vectorized form as:

\[(A_i \otimes I - I \otimes A_i^T) \text{vec}(X) = 0, \quad \forall A_i \in \mathcal{A}.\]

where \(\text{vec}(X)\) denotes the column-wise vectorization of \(X\). The null space of this equation provides a basis for the commutant.

This implementation is based on [1].

Examples

Consider the following set of matrices:

\[\begin{split}A_1 = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}, \quad A_2 = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\end{split}\]

The commutant consists of matrices that commute with both \(A_1\) and \(A_2\).

import numpy as np
from toqito.matrix_props import commutant

A1 = np.array([[1, 0], [0, -1]])
A2 = np.array([[0, 1], [1, 0]])

basis = commutant([A1, A2])

basis
[array([[0.70710678, 0.        ],
        [0.        , 0.70710678]])]

Now, consider a single matrix:

\[\begin{split}A = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}\end{split}\]
import numpy as np
from toqito.matrix_props import commutant

A = np.array([[1, 1], [0, 1]])

basis = commutant(A)

for i, basis_ in enumerate(basis):
   print(f"basis{ i} :\n{basis_} \n")
basis0 :
[[0.70710678 0.        ]
 [0.         0.70710678]] 

basis1 :
[[ 0. -1.]
 [ 0.  0.]] 

References

[1]

Nathaniel Johnston. QETLAB: A MATLAB toolbox for quantum entanglement. URL: https://github.com/nathanieljohnston/QETLAB, doi:10.5281/zenodo.44637.

[2] (1,2)

PlanetMath. Commutant. URL: https://planetmath.org/commutant.

Parameters:

A (numpy.ndarray | list[numpy.ndarray]) – A single matrix of the form np.ndarray or a list of square matrices of the same dimension.

Returns:

A list of matrices forming an orthonormal basis for the commutant.

Return type:

list[numpy.ndarray]