%test swap_t3() global_defs; example = 1; switch example case (1) a0= get_unit_vec(randn(3,1)); b0= get_unit_vec(cross(a0,randn(3,1))); c0= get_unit_vec(cross(a0,randn(3,1))); a1= get_unit_vec(randn(3,1)); b1= get_unit_vec(cross(a1,randn(3,1))); c1= get_unit_vec(cross(a1,randn(3,1))); otherwise error("example number is out of range"); end vecs_in=[c0,b0,a0;c1,b1,a1]; [vecs_out, U1, U0] = swap_t3(vecs_in); a0f=vecs_out(1:3,1); a1f=vecs_out(4:6,1); % c0 b0 a0 a0f [U0] % | | | --> | % c1 b1 a1 a1f [U1] %where a0 is perp to span(b0,c0) %and a1 is perp to span(b1,c1) error = norm( dr11(c1,c0)*dr11(b1,b0)*dr11(a1,a0) - dr11(a1f,a0f)*kron(U1,U0))