Difference between revisions of "ApplyMap"
(Created page with "{{Function |name=ApplyMap |desc=Applies a superoperator to an operator |rel=PartialMap |upd=January 2, 2013 |v=1.00}} <tt>'''ApplyMap'''</tt> is a [[List of functions|...") |
|||
| Line 3: | Line 3: | ||
|desc=Applies a [[superoperator]] to an operator | |desc=Applies a [[superoperator]] to an operator | ||
|rel=[[PartialMap]] | |rel=[[PartialMap]] | ||
| + | |cat=[[List of functions#Superoperators|Superoperators]] | ||
|upd=January 2, 2013 | |upd=January 2, 2013 | ||
| − | |v= | + | |v=0.50}} |
<tt>'''ApplyMap'''</tt> is a [[List of functions|function]] that applies a [[superoperator]] to an operator. Both the superoperator and the operator may be either full or sparse. | <tt>'''ApplyMap'''</tt> is a [[List of functions|function]] that applies a [[superoperator]] to an operator. Both the superoperator and the operator may be either full or sparse. | ||
| Line 20: | Line 21: | ||
\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. | \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. | ||
$$ | $$ | ||
| − | < | + | <syntaxhighlight> |
>> X = [1 2;3 4]; | >> 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]}; | >> 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]}; | ||
| Line 30: | Line 31: | ||
2 8 14 | 2 8 14 | ||
8 29 64 | 8 29 64 | ||
| − | </ | + | </syntaxhighlight> |
===Transpose map=== | ===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: | 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: | ||
| − | < | + | <syntaxhighlight> |
>> X = reshape(1:9,3,3) | >> X = reshape(1:9,3,3) | ||
| Line 43: | Line 44: | ||
3 6 9 | 3 6 9 | ||
| − | >> ApplyMap(X, | + | >> ApplyMap(X,SwapOperator(3)) |
ans = | ans = | ||
| Line 50: | Line 51: | ||
4 5 6 | 4 5 6 | ||
7 8 9 | 7 8 9 | ||
| − | </ | + | </syntaxhighlight> |
Of course, in practice you should just use MATLAB's built-in transposition operator <tt>X.'</tt>. | Of course, in practice you should just use MATLAB's built-in transposition operator <tt>X.'</tt>. | ||
| + | |||
| + | {{SourceCode|name=ApplyMap}} | ||
Revision as of 15:20, 29 September 2014
| 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 64Transpose 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 9Of 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.