channels.partial_transpose¶
Generates the partial transpose of a matrix.
Functions¶
|
Compute the partial transpose of a matrix [1]. |
Module Contents¶
- channels.partial_transpose.partial_transpose(rho, sys=None, dim=None)¶
Compute the partial transpose of a matrix [1].
The partial transpose is defined as
\[\left( \text{T} \otimes \mathbb{I}_{\mathcal{Y}} \right) \left(X\right)\]where \(X \in \text{L}(\mathcal{X})\) is a linear operator over the complex Euclidean space \(\mathcal{X}\) and where \(\text{T}\) is the transpose mapping \(\text{T} \in \text{T}(\mathcal{X})\) defined as
\[\text{T}(X) = X^{\text{T}}\]for all \(X \in \text{L}(\mathcal{X})\).
By default, the returned matrix is the partial transpose of the matrix
rho
, where it is assumed that the number of rows and columns ofrho
are both perfect squares and both subsystems have equal dimension. The transpose is applied to the second subsystem.In the case where
sys
amddim
are specified, this function gives the partial transpose of the matrixrho
where the dimensions of the (possibly more than 2) subsystems are given by the vectordim
and the subsystems to take the partial transpose are given by the scalar or vectorsys
. Ifrho
is non-square, different row and column dimensions can be specified by putting the row dimensions in the first row ofdim
and the column dimensions in the second row ofdim
.Examples
Consider the following matrix
\[\begin{split}X = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8 \\ 9 & 10 & 11 & 12 \\ 13 & 14 & 15 & 16 \end{pmatrix}.\end{split}\]Performing the partial transpose on the matrix \(X\) over the second subsystem yields the following matrix
\[\begin{split}X_{pt, 2} = \begin{pmatrix} 1 & 5 & 3 & 7 \\ 2 & 6 & 4 & 8 \\ 9 & 13 & 11 & 15 \\ 10 & 14 & 12 & 16 \end{pmatrix}.\end{split}\]By default, in
toqito
, the partial transpose function performs the transposition on the second subsystem as follows.>>> from toqito.channels import partial_transpose >>> import numpy as np >>> test_input_mat = np.arange(1, 17).reshape(4, 4) >>> partial_transpose(test_input_mat) array([[ 1, 5, 3, 7], [ 2, 6, 4, 8], [ 9, 13, 11, 15], [10, 14, 12, 16]])
By specifying the
sys = 1
argument, we can perform the partial transpose over the first subsystem (instead of the default second subsystem as done above). Performing the partial transpose over the first subsystem yields the following matrix\[\begin{split}X_{pt, 1} = \begin{pmatrix} 1 & 2 & 9 & 10 \\ 5 & 6 & 13 & 14 \\ 3 & 4 & 11 & 12 \\ 7 & 8 & 15 & 16 \end{pmatrix}.\end{split}\]>>> from toqito.channels import partial_transpose >>> import numpy as np >>> test_input_mat = np.array( ... [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]] ... ) >>> partial_transpose(test_input_mat, 1) array([[ 1, 5, 3, 7], [ 2, 6, 4, 8], [ 9, 13, 11, 15], [10, 14, 12, 16]])
References
[1] (1,2)Wikipedia. Peres-horodecki criterion. URL: https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion.
- Parameters:
rho (numpy.ndarray | cvxpy.expressions.variable.Variable) – A matrix.
sys (list[int] | numpy.ndarray | int) – Scalar or vector specifying the size of the subsystems.
dim (list[int] | numpy.ndarray) – Dimension of the subsystems. If
None
, all dimensions are assumed to be equal.
- Raises:
ValueError – If matrix dimensions are not square.
- Returns:
The partial transpose of matrix
rho
.- Return type:
numpy.ndarray | cvxpy.expressions.expression.Expression