Difference between revisions of "DiamondNorm"
(Updated since it can now be used within CVX optimization problems) |
|||
Line 3: | Line 3: | ||
|desc=Computes the [[diamond norm]] of a superoperator | |desc=Computes the [[diamond norm]] of a superoperator | ||
|req=[http://cvxr.com/cvx/ cvx] | |req=[http://cvxr.com/cvx/ cvx] | ||
− | |rel=[[CBNorm]] | + | |rel=[[CBNorm]]<br />[[MaximumOutputFidelity]] |
|cat=[[List of functions#Norms|Norms]] | |cat=[[List of functions#Norms|Norms]] | ||
− | |upd= | + | |upd=November 21, 2014}} |
− | |||
<tt>'''DiamondNorm'''</tt> is a [[List of functions|function]] that computes the [[diamond norm]] $\|\Phi\|_\diamond$ of a superoperator $\Phi$. | <tt>'''DiamondNorm'''</tt> is a [[List of functions|function]] that computes the [[diamond norm]] $\|\Phi\|_\diamond$ of a superoperator $\Phi$. | ||
Line 58: | Line 57: | ||
1.4142 | 1.4142 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ===Can be used within CVX=== | ||
+ | The diamond norm is convex (like all norms) and this function can be used in the same way as any other convex function within CVX. Thus you can minimize the diamond norm or use the diamond norm in constraints of CVX optimization problems. For example, the following code finds the closest Pauli channel (i.e., channel with Kraus operators all of which are multiples of Pauli matrices) to a given 2-qubit channel, where the measure of "closest" is the diamond norm: | ||
+ | <syntaxhighlight> | ||
+ | >> num_qubits = 2; | ||
+ | >> H = [1,1;1,-1]/sqrt(2); % Hadamard gate | ||
+ | >> Psi = ChoiMatrix({Tensor(H,num_qubits)}); % channel that acts as Hadamard gate on 2 qubits | ||
+ | >> cvx_begin sdp quiet | ||
+ | variable Phi(4^num_qubits,4^num_qubits) hermitian; | ||
+ | variable p(4^num_qubits); | ||
+ | |||
+ | % Let's construct a general Pauli channel. | ||
+ | PauliLinComb = zeros(4^num_qubits,4^num_qubits); | ||
+ | for j = 1:4^num_qubits | ||
+ | bitind = bitget(j-1,1:2*num_qubits); | ||
+ | ind = bitind(1:2:2*num_qubits) + 2*bitind(2:2:2*num_qubits); | ||
+ | PauliLinComb = PauliLinComb + p(j)*ChoiMatrix({Pauli(ind)}); | ||
+ | end | ||
+ | |||
+ | minimize DiamondNorm(Phi - Psi) | ||
+ | |||
+ | subject to | ||
+ | % these first two constraints force Phi to be a quantum channel | ||
+ | PartialTrace(Phi) == eye(2^num_qubits); % trace-preserving | ||
+ | Phi >= 0; % completely positive | ||
+ | |||
+ | % the following constraint forces Phi to have Pauli Kraus operators | ||
+ | Phi == PauliLinComb; | ||
+ | sum(p) == 1; | ||
+ | cvx_end | ||
+ | cvx_optval | ||
+ | |||
+ | cvx_optval = | ||
+ | |||
+ | 1.5000 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{SourceCode|name=DiamondNorm}} | {{SourceCode|name=DiamondNorm}} |
Revision as of 21:31, 27 November 2014
DiamondNorm | |
Computes the diamond norm of a superoperator | |
Other toolboxes required | cvx |
---|---|
Related functions | CBNorm MaximumOutputFidelity |
Function category | Norms |
DiamondNorm is a function that computes the diamond norm $\|\Phi\|_\diamond$ of a superoperator $\Phi$.
Syntax
- DN = DiamondNorm(PHI)
- DN = DiamondNorm(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). PHIC will be a cell of Kraus operators if PHI is a cell of Kraus operators, and similarly PHIC 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
A completely positive map
If $\Phi$ is completely positive then $\|\Phi\|_{\diamond} = \|\Phi^\dagger(I)\|$, where $I$ is the identity matrix, $\Phi^\dagger$ is the dual map of $\Phi$, and $\|\cdot\|$ is the usual operator norm, which we can verify in a special case via the following code:
>> Phi = {[1 2;3 4] ; [0 1;2 0] ; [1 1;-1 3]};
>> DiamondNorm(Phi)
ans =
37.6510
>> norm(ApplyMap(eye(2),DualMap(Phi)))
ans =
37.6510
A difference of unitaries channel
If $\Phi(X) = X - UXU^\dagger$, then the diamond norm of $\Phi$ is the diameter of the smallest circle that contains the eigenvalues of $U$, which we can verify in a special case via the following code:
>> U = [1 1;-1 1]/sqrt(2);
>> Phi = {eye(2),eye(2); U,-U};
>> DiamondNorm(Phi)
ans =
1.4142
>> lam = eig(U)
lam =
0.7071 + 0.7071i
0.7071 - 0.7071i
>> abs(lam(1) - lam(2))
ans =
1.4142
Can be used within CVX
The diamond norm is convex (like all norms) and this function can be used in the same way as any other convex function within CVX. Thus you can minimize the diamond norm or use the diamond norm in constraints of CVX optimization problems. For example, the following code finds the closest Pauli channel (i.e., channel with Kraus operators all of which are multiples of Pauli matrices) to a given 2-qubit channel, where the measure of "closest" is the diamond norm:
>> num_qubits = 2;
>> H = [1,1;1,-1]/sqrt(2); % Hadamard gate
>> Psi = ChoiMatrix({Tensor(H,num_qubits)}); % channel that acts as Hadamard gate on 2 qubits
>> cvx_begin sdp quiet
variable Phi(4^num_qubits,4^num_qubits) hermitian;
variable p(4^num_qubits);
% Let's construct a general Pauli channel.
PauliLinComb = zeros(4^num_qubits,4^num_qubits);
for j = 1:4^num_qubits
bitind = bitget(j-1,1:2*num_qubits);
ind = bitind(1:2:2*num_qubits) + 2*bitind(2:2:2*num_qubits);
PauliLinComb = PauliLinComb + p(j)*ChoiMatrix({Pauli(ind)});
end
minimize DiamondNorm(Phi - Psi)
subject to
% these first two constraints force Phi to be a quantum channel
PartialTrace(Phi) == eye(2^num_qubits); % trace-preserving
Phi >= 0; % completely positive
% the following constraint forces Phi to have Pauli Kraus operators
Phi == PauliLinComb;
sum(p) == 1;
cvx_end
cvx_optval
cvx_optval =
1.5000
Source code
Click here to view this function's source code on github.