ApplyMap
ApplyMap | |
Applies a superoperator to an operator | |
Other toolboxes required | none |
---|---|
Related functions | PartialMap |
Function category | Superoperators |
ApplyMap is a function that applies a superoperator to an operator. Both the superoperator and the operator may be either full or sparse.
Syntax
- PHIX = ApplyMap(X,PHI)
Argument descriptions
- X: A matrix.
- PHI: A superoperator. Should be provided as either a Choi matrix, or as a cell with either 1 or 2 columns (see the tutorial page for more details about specifying superoperators within QETLAB).
Examples
A random example
The following code computes $\Phi(X)$, where $X = \begin{bmatrix}1 & 2 \\ 3 & 4\end{bmatrix}$ and $\Phi$ is the superoperator defined by $$ \Phi(X) = \begin{bmatrix}1 & 5 \\ 1 & 0 \\ 0 & 2\end{bmatrix}X\begin{bmatrix}0 & 1 \\ 2 & 3 \\ 4 & 5\end{bmatrix}^\dagger - \begin{bmatrix}1 & 0 \\ 0 & 0 \\ 0 & 1\end{bmatrix}X\begin{bmatrix}0 & 0 \\ 1 & 1 \\ 0 & 0\end{bmatrix}^\dagger. $$
>> X = [1 2;3 4];
>> Phi = {[1 5;1 0;0 2] [0 1;2 3;4 5];[-1 0;0 0;0 -1] [0 0;1 1;0 0]};
>> ApplyMap(X,Phi)
ans =
22 95 174
2 8 14
8 29 64
Transpose map
The swap operator is the Choi matrix of the transpose map. Thus, the following code is a (rather slow and ugly) way of computing the transpose of a matrix:
>> X = reshape(1:9,3,3)
X =
1 4 7
2 5 8
3 6 9
>> ApplyMap(X,SwapOperator(3))
ans =
1 2 3
4 5 6
7 8 9
Of course, in practice you should just use MATLAB's built-in transposition operator X.'.
Source code
Click here to view this function's source code on github.