gusucode.com > qit_matlab_0.10.0工具箱源码程序 > qit/+invariant/max_concurrence.m

    function C = max_concurrence(c)
% MAX_CONCURRENCE  Maximum concurrence generated by a two-qubit gate.
%  C = max_concurrence(U) % gate
%  C = max_concurrence(c) % canonical invariants
%
%  Returns the maximum concurrence generated by the two-qubit
%  gate U, starting from a tensor state.
%
%  Alternatively, U may be given in terms of a vector of three
%  canonical local invariants.

%! B. Kraus and J. I. Cirac, "Optimal creation of entanglement using a two-qubit gate", PRA 63, 062309 (2001).
% Ville Bergholm 2006-2010


if (size(c, 2) == 4)
  % gate into corresponding invariants
  c = invariant.canonical(c);
end

temp = circshift(c, [0, 1]);
C = max(abs(sin(pi*[c-temp, c+temp])), [], 2);