Cayley-Dickson decomposition
[A, B] = cd(q)
cd returns two values which are the Cayley-Dickson components of the argument. The Cayley-Dickson form represents a quaternion as a complex number with two complex components: q = A + Bj where A = w + x i, B = y + z i. Thus: q = (w + x i) + (y + z i) j = w + xi + yj + zk. The Cayley-Dickson form of an octonion represents the octonion as a complex number with quaternion components: o = A + Bl where A and B are quaternions, and l is the octonion operator l.
Expressed in Matlab/QTFM code, A and B are such that:
q = quaternion(real(A), imag(A), real(B), imag(B)),or in the octonion case:
o = octonion(part(A, 1), part(A, 2), part(A, 3), part(A, 4), part(B, 1), part(B, 2), part(B, 3), part(B, 4)).
The name of this function is the same as the MATLAB® command for changing directory, but the quaternion function is called only when the argument is a quaternion. Since a quaternion cannot designate a directory, there is no conflict.
>> q = randq q = 0.01899 - 0.2061 * I - 0.9299 * J + 0.304 * K >> [A, B] = cd(q) A = 0.0190 - 0.2061i B = -0.9299 + 0.3040i