function [out]=transmission(sigma_left,sigma_right,gr)
%computes transmission function for 1D tight-binding chain attached to ferromagnetic electrodes

N_m=length(gr);

gamma_left=i*(sigma_left-sigma_left'); %level broadening matrix from left F electrode
gamma_right=i*(sigma_right-sigma_right'); %level broadening matrix from right F electrode

ga=gr'; %advanced green function

out=real(trace(gamma_right*gr(N_m-1:N_m,1:2)*gamma_left*ga(1:2,N_m-1:N_m))); %Caroli et al. formula

end %function transmission 


