%test sim_trans_t4() global_defs; example = 1; switch example case (1) lam = 2*pi*rand(); c_lam = cos(lam); s_lam = sin(lam); phi = 2*pi*rand(); c_phi = cos(phi); s_phi = sin(phi); a0 = [c_lam;s_lam;0]; a1 = a0; b0 = [1;0;0]; b1 = b0; c0 = [ s_phi; 0; c_phi]; c1 = [-s_phi; 0; c_phi]; otherwise error("example number is out of range"); end vecs_in=[c0,b0,a0;c1,b1,a1]; [vecs_out, U1, U0] = sim_trans_t4(vecs_in); a0f=vecs_out(1:3,1); a1f=vecs_out(4:6,1); % c0 b0 a0 a0f [U0] % | | | --> | % c1 b1 a1 a1f [U1] %Let {sx,sy,sz} be the standard basis. Then %a0=a1=cos(lam)sx -sin(lam)sy %b0=b1=sx %c0=cos(phi)sz +sin(phi)sx %c1=cos(phi)sz -sin(phi)sx error = norm( dr11(c1,c0)*dr11(b1,b0)*dr11(a1,a0) - dr11(a1f,a0f)*kron(U1,U0))