toqito.channels.ldot_channel ============================ .. py:module:: toqito.channels.ldot_channel .. autoapi-nested-parse:: Local diagonal orthogonal twirl channel. Module Contents --------------- .. py:function:: ldot_channel(mat, efficient = True) Apply the local diagonal orthogonal twirl (LDOT) channel to a matrix. The LDOT channel projects a matrix onto the subspace of local diagonal orthogonal invariant (LDOI) matrices. It is defined as: \[ \Phi_O(A) = \frac{1}{2^n} \sum_{O \in \text{DO}(\mathcal{X})} (O \otimes O) A (O \otimes O) \] where \(\text{DO}(\mathcal{X})\) is the set of \(n \times n\) diagonal matrices with diagonal entries equal to \(\pm 1\). The LDOT channel has the following properties: - It is a quantum channel (completely positive and trace-preserving) - It is self-adjoint: \(\Phi_O^* = \Phi_O\) - It preserves PPT and separability - It is an orthogonal projection onto the LDOI subspace The efficient implementation works directly in the computational basis, zeroing out the entries that average to zero under the twirl. This keeps the complexity polynomial in \(n\) instead of the exponential \(O(2^n)\) for the brute-force approach. .. rubric:: Examples Apply LDOT channel to project an arbitrary matrix onto LDOI subspace: ```python exec="1" source="above" from toqito.channels import ldot_channel import numpy as np # Arbitrary 2-qubit matrix mat = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) ldoi_projection = ldot_channel(mat) print(ldoi_projection) ``` The LDOT channel is idempotent (applying it twice gives the same result): ```python exec="1" source="above" from toqito.channels import ldot_channel import numpy as np mat = np.random.rand(4, 4) once = ldot_channel(mat) twice = ldot_channel(once) print(np.allclose(once, twice)) ``` :param mat: A square matrix of dimension \(n^2 \times n^2\) representing a bipartite operator on \(\mathcal{X} \otimes \mathcal{Y}\) where \(\mathcal{X} = \mathcal{Y} = \mathbb{C}^n\). :param efficient: If True, use the efficient O(n²) standard basis implementation. If False, use the brute-force O(2ⁿ) implementation (useful for verification). :returns: The LDOI projection of the input matrix.