%Tests functions on which kak1.m depends:
%rand_unitary.m, 
%SO4_to_SU2xSU2.m,
%diag_to_class_vec.m,
%class_vec_to_mat.m

global_defs;

X = rand_unitary(5, true);
err1= abs(det(X)-1)
err2= norm(X*X'-eye(5))

A = rand_unitary(2, true);
B = rand_unitary(2, true);
U = kron(A, B);
Q = uni2ort'*U*uni2ort;
err3=norm(eye(4)-Q*transpose(Q))

[Anew,Bnew] = SO4_to_SU2xSU2(Q);
err4=norm(U - kron(Anew, Bnew))

dd = exp(i*2*pi*randn(4,1));
dd = dd/(prod(dd))^(1/4);
cvec= diag_to_class_vec(dd);
cmat = class_vec_to_mat(cvec);
err5=norm(uni2ort'*cmat*uni2ort-diag(dd))