% Multiplication matrix for quaternions, commuted factors p q = calc_Mq_comm(q)*p, see PCV (8.46) Usage: M = calc_Mq_comm(q) q - double 4x1, quaternion M - double 4x4, Multiplication matrix for quaternions Wolfgang Förstner wfoerstn@uni-bonn.de See also calc_Mq, calc_R_from_opq_kraus, calc_r_phi_from_R, calc_Rot_ab, calc_Rot_q, calc_Rot_r, calc_Rot_rod, calc_Rot_rp, calc_opq_from_R_Kraus
0001 %% Multiplication matrix for quaternions, commuted factors 0002 % p q = calc_Mq_comm(q)*p, see PCV (8.46) 0003 % 0004 % Usage: 0005 % M = calc_Mq_comm(q) 0006 % 0007 % q - double 4x1, quaternion 0008 % 0009 % M - double 4x4, Multiplication matrix for quaternions 0010 % 0011 % Wolfgang Förstner 0012 % wfoerstn@uni-bonn.de 0013 % 0014 % See also calc_Mq, calc_R_from_opq_kraus, calc_r_phi_from_R, calc_Rot_ab, 0015 % calc_Rot_q, calc_Rot_r, calc_Rot_rod, calc_Rot_rp, 0016 % calc_opq_from_R_Kraus 0017 0018 function M=calc_Mq_comm(q) 0019 0020 a = q(1); 0021 b = q(2); 0022 c = q(3); 0023 d = q(4); 0024 M =[ a -b -c -d; ... 0025 b a d -c; ... 0026 c -d a b; ... 0027 d c -b a 0028 ];