function mat = class_k_to_mat(k)

%Builds a 4d matrix mat = e^{i (k_0 + k.Sigma)}
%characterized by a class vector k(1:3) and 
%a global phase k(4).

global_declarations;

mat= e^(i*k(4))*(cos(k(1))*eye(4) + i*sin(k(1))*sigxx
)*(cos(k(2))*eye(4) + i*sin(k(2))*sigyy
)*(cos(k(3))*eye(4) + i*sin(k(3))*sigzz);