# DualMap

 Other toolboxes required DualMap Computes the dual of a superoperator in the Hilbert-Schmidt inner product none ComplementaryMap Superoperators

DualMap is a function that computes the dual of a superoperator in the Hilbert-Schmidt inner product. If $\Phi(X) = \sum_j A_j X B_j^\dagger$ for all matrices $X$, then the dual map is defined by $\Phi^\dagger(Y) = \sum_j A_j^\dagger Y B_j$.

## Syntax

• PHID = DualMap(PHI)
• PHID = DualMap(PHI,DIM)

## Argument descriptions

• 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). PHID will be a cell of Kraus operators if PHI is a cell of Kraus operators, and similarly PHID will be a Choi matrix if PHI is a Choi matrix.
• DIM (optional, default has input and output spaces of equal dimension): A 1-by-2 vector containing the input and output dimensions of PHI, in that order (equivalently, these are the dimensions of the first and second subsystems of the Choi matrix PHI, in that order). If the input or output space is not square, then DIM's first row should contain the input and output row dimensions, and its second row should contain its input and output column dimensions. DIM is required if and only if PHI has unequal input and output dimensions and is provided as a Choi matrix.

## Examples

### The dual of the dual map

As its name implies, the dual of the dual of a map $\Phi$ is $\Phi$ itself, which we see in a special case in the following code:

>> Phi = RandomSuperoperator(3);
>> norm(ChoiMatrix(DualMap(DualMap(Phi))) - ChoiMatrix(Phi))

ans =

0

## Source code

Click on "expand" to the right to view the MATLAB source code for this function.

1. %%  DUALMAP    Computes the dual of a superoperator in the Hilbert-Schmidt inner product
2. %   This function has one required argument:
3. %     PHI: a superoperator
4. %
5. %   PHID = DualMap(PHI) is the dual map (in the Hilbert-Schmidt inner
6. %   product) of the superoperator PHI. If PHI is provided as a cell of
7. %   Kraus operators, then so is PHID. If PHI is provided as a Choi matrix,
8. %   then so is PHID. If PHI is provided as a Choi matrix the input space is
9. %   not of dimension equal to that of the output space, a second argument
10. %   DIM must be provided (see below).
11. %
12. %   This function has one optional input argument:
13. %     DIM (default has input and output of equal dimension)
14. %
15. %   PHID = DualMap(PHI,DIM) is the same as above, where DIM is a
16. %   1-by-2 vector containing the input and output dimensions of PHI, in
17. %   that order (equivalently, these are the dimensions of the first and
18. %   second subsystems of the Choi matrix PHI, in that order). If the input
19. %   or output space is not square, then DIM's first row should contain the
20. %   input and output row dimensions, and its second row should contain its
21. %   input and output column dimensions. DIM is required if and only if PHI
22. %   has unequal input and output dimensions and is provided as a Choi
23. %   matrix.
24. %
25. %   URL: http://www.qetlab.com/DualMap
26. 
27. %   requires: opt_args.m, PermuteSystems.m, sporth.m, superoperator_dims.m,
28. %             Swap.m
29. %
30. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
31. %   package: QETLAB
32. %   last updated: November 24, 2014
33. 
34. function PhiD = DualMap(Phi,varargin)
35. 
36. if(iscell(Phi)) % Phi is provided as a set of Kraus operators
37.     PhiD = cellfun(@ctranspose,Phi,'UniformOutput',false);
38. else % Phi is provided as a Choi matrix
39.     % Get the dimensions of PHI.
40.     [da,db] = superoperator_dims(Phi,1,varargin{:});
41. 
42.     % Compute the dual map.
43.     PhiD = Swap(conj(Phi),[1,2],[da.',db.']);
44. end