⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optspinsq.m

📁 量子信息科学使用的源码以及量子进化算法
💻 M
字号:
% optspinsq(rho)   Optimal spin squeezing inequalities
%    optspinsq(rho) gives back a negative value if the
%    multi-qubit state rho is detected as entangled
%    by the optimal spin squeezing inequalities.
%    (See http://arxiv.org/abs/quant-ph/0702219.) 
%    The form [fmin,f123]=optspinsq(rho) gives back
%    in f123 a three element array. Each element of the
%    array gives -1 times the violation of the corresponding spin
%    squeezing inequality. fmin is the minimum of the three values.
%    If one of them is negative then the state is detected as entangled.
%    Beside the inequalities themselves, a method is also
%    implemented that looks for the optimal choice of x, y, and z
%    coordinates (See above paper).

% Copyright (C) 2007  Geza Toth    E.mail: toth@alumni.nd.edu
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; see gpl.txt
% of this subroutine package.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
% 
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, 
% Boston, MA  02110-1301, USA.

function [fmin,f123]=optspinsq(rho)

[sy,sx]=size(rho);
N=log2(sx);

% Collective observables
paulixyz;
Jx=coll(x,N); % Here I did not use the 1/2!
Jy=coll(y,N);
Jz=coll(z,N);

% Correlation matrix
Cxx=trace(rho*Jx*Jx);
Cyy=trace(rho*Jy*Jy);
Czz=trace(rho*Jz*Jz);
Cxy=trace(rho*(Jx*Jy+Jy*Jx)/2);
Cxz=trace(rho*(Jx*Jz+Jz*Jx)/2);
Cyz=trace(rho*(Jy*Jz+Jz*Jy)/2);
C=[Cxx Cxy Cxz;Cxy Cyy Cyz; Cxz Cyz Czz];

% Covariance matrix
v=[trace(Jx*rho) trace(Jy*rho) trace(Jz*rho)];
g=C-v.'*v;

X=(N-1)*g+C;
% /4 is needed since the definition of Jx (Jx=coll(x,N)) did not include a
% factor of 1/2
f123=[trace(g)-2*N,mineig(X)-trace(C)+2*N,(N-1)*trace(g)-N*(N-2)-maxeig(X)]/4;
fmin=min(real(f123));



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -