%test dr_3to2() global_defs; example = 1; switch example case (1) persistence = 0; a0= get_unit_vec(randn(3,1)); b0= get_unit_vec(randn(3,1)); c0= get_unit_vec(randn(3,1)); a1= get_unit_vec(randn(3,1)); b1= get_unit_vec(randn(3,1)); cross_ab1 = cross(a1,b1); cross_abb1 = cross(cross_ab1,b1); c1= get_normal_unit_vec(cross_abb1,[0;0;0]); otherwise error("example number is out of range"); end vecs_in=[c0,b0,a0;c1,b1,a1]; [vecs_out, U1, U0] = dr_3to2(vecs_in, persistence); b0f=vecs_out(1:3,1); a0f=vecs_out(1:3,2); b1f=vecs_out(4:6,1); a1f=vecs_out(4:6,2); % c0 b0 a0 b0f a0f [U0] % | | | --> | | *exp(i*pi/4) % c1 b1 a1 b1f a1f [U1] error1 = norm(dr11(c1,c0)*dr11(b1,b0)*dr11(a1,a0) -dr11(b1f,b0f)*dr11(a1f,a0f)*kron(U1,U0)*exp(i*pi/4) )