channel_dim
¶
Computes the input, output, and environment dimensions of a channel.
channel_dim
¶
channel_dim(
phi: ndarray | list[ndarray] | list[list[ndarray]],
allow_rect: bool = True,
dim: int | list[int] | ndarray | None = None,
compute_env_dim: bool = True,
) -> tuple[ndarray | int, ndarray | int, int | None]
Compute the input, output, and environment dimensions of a channel.
This function returns the dimensions of the input, output, and environment spaces of the
input channel, in that order. Input and output dimensions are both \(1 \times 2\) vectors
containing the row and column dimensions of their spaces. The environment dimension is
always a scalar, and it is equal to the number of Kraus operators of phi (if phi is
provided as a Choi matrix then the environment dimension is the minimal number of Kraus
operators of any representation of phi).
The dim argument should be provided if and only if phi is a Choi matrix with unequal
input and output dimensions (since it is impossible to determine the input and output
dimensions from the Choi matrix alone). If allow_rect is false and phi acts on
non-square matrix spaces, an error will be produced. If phi maps \(M_{r,c}\) to
\(M_{x,y}\) then dim should be the \(2 \times 2\) matrix [[r,x], [c,y]]. If phi maps
\(M_m\) to \(M_n\), then dim can simply be the vector [m,n]. If allow_rect is false
then the returned input and output dimensions will be scalars instead of vectors. If
compute_env_dim is false and phi is a Choi matrix we avoid computing the rank of the
Choi matrix.
This function was adapted from QETLAB 1.
Parameters:
-
phi(ndarray | list[ndarray] | list[list[ndarray]]) –A superoperator. It should be provided either as a Choi matrix, or as a (1d or 2d) list of numpy arrays whose entries are its Kraus operators.
-
allow_rect(bool, default:True) –A flag indicating that the input and output spaces of
phican be non-square (default True). -
dim(int | list[int] | ndarray | None, default:None) –A scalar, vector or matrix containing the input and output dimensions of
phi. -
compute_env_dim(bool, default:True) –A flag indicating whether we compute the environment dimension.
Returns:
-
tuple[ndarray | int, ndarray | int, int | None]–The input, output, and environment dimensions of a channel.
Examples:
The dimensions of a channel can be computed from a list of Kraus operators. For example, the following Kraus operators describe a qubit bit-flip channel:
import numpy as np
from toqito.channel_props.channel_dim import channel_dim
kraus_ops = [
np.sqrt(0.5) * np.eye(2),
np.sqrt(0.5) * np.array([[0, 1], [1, 0]]),
]
dim_in, dim_out, dim_env = channel_dim(kraus_ops)
print(dim_in, dim_out, dim_env)
References
1 Johnston, Nathaniel. {{QETLAB}: {A MATLAB} toolbox for quantum entanglement}. doi:10.5281/zenodo.44637.
Source code in toqito/channel_props/channel_dim.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |