Singular value decomposition
(Quaternion overloading of standard MATLAB® function)
[U,S,V] = svd(X, econ)
svd computes the quaternion singular value decomposition. This decomposition generalises from the case of real and complex matrices. The singular values are real (even in the case of a complex quaternion matrix), and the singular vectors are quaternion-valued (complex quaternion-valued in the case of a complex quaternion matrix). Thus U and V are unitary quaternion matrices, and S is a real diagonal matrix.
>> q = randq(4) q = 4x4 quaternion array >> [U, S, V] = svd(q) U = 4x4 quaternion array S = 3.0473 0 0 0 0 2.1201 0 0 0 0 1.3996 0 0 0 0 0.5104 V = 4x4 quaternion array >> U * S * V' - q ans = 4x4 quaternion array >> max(max(abs(ans))) ans = 1.8660e-15Similarly with a complex quaternion matrix (note the double use of abs when checking the reconstruction - because the modulus of a complex quaternion is complex it is necessary to take the modulus of the modulus so that the maximum can be found):
>> q = complex(randq(4), randq(4)) .* randn(4) q = 4x4 complex quaternion array >> [U, S, V] = svd(q) U = 4x4 complex quaternion array S = 6.9636 0 0 0 0 2.8856 0 0 0 0 1.9821 0 0 0 0 0.5788 V = 4x4 complex quaternion array >> U * S * V' - q ans = 4x4 complex quaternion array >> max(max(abs(abs(ans)))) ans = 6.8965e-13