c33ae98Companion to 'Coding closed and open quantum systems in MATLAB' (arXiv:1911.04906)Jeremy Magland 1function x = sigmap(i,L,Is,Icav)
2up = [1 0]';
3down = [0 1]';
4sigma_p = up*down';
5sigma_p = kron(sigma_p,Icav);
6Op_total = cell(1,L);
7for site = 1:L
8 Op_total{site} = Is+double(eq(i,site))*(sigma_p-Is);
9end
10x = Op_total{1};
11for site = 2:L
12 x = kron(x,Op_total{site});
13end
14end