source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/qtfm/Implementation notes.txt @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 3.4 KB
Line 
1Implementation notes
2--------------------
3
4The following are general points about the implementation of the quaternion
5toolbox. It is intended to expand these notes in due course to give more
6detailed information about the design of the toolbox.
7
81. The representation of a quaternion is hidden in a small number of private
9functions. This is to keep the bulk of the functions in the library separate
10from the representation, and to facilitate a later change of representation
11if needed.
12   
132. Functions which are overloadings of Matlab functions generally take the
14same parameters as the Matlab function, but there are some exceptions where
15the Matlab function seemed to have unnecessary parameter combinations that
16are of little use.
17
183. Functions are inherently matrix-oriented as with standard Matlab functions.
19
204. Errors are limited to cases where parameters are incorrect or not supported.
21
225. Warnings are issued in cases where a result will be incorrect (for example
23a NaN, but the computation is not stopped). Generally the problem should be
24fixed at a higher level than the point where the warning occurs. If this is in
25one of the functions of the toolbox, the problem should be reported, otherwise
26if it is user code it should be fixed there.
27
286. Because the toolbox is designed to work with complexified quaternions (that
29is quaternions in which the four components are complex), there are some tricks
30in some of the functions. The modulus of a complex quaternion is complex, and it
31may be zero. This has many ramifications. One example suffices to illustrate the
32tricks needed. In the function unit.m, it is necessary to divide a quaternion by
33its modulus. There is an error check in the function to give a warning if any
34element of the quaternion array has zero modulus (in fact less than epsilon),
35but since the modulus may be complex, it is abs(m) that is compared with eps and
36not m itself. Note that if the modulus is real, abs(m) == m, and the abs
37function has no effect, whereas, if the modulus is complex, abs(m) is real, and
38it can only be zero if the modulus is zero.
39
407. The overloading of the Matlab functions real, imag and conj is important.
41real and imag operate exactly as their complex counterparts. Applied to a
42complex quaternion they return a real quaternion which is the real or imaginary
43part of the complex quaternion, exactly analogous to the complex case. conj,
44however, is different since it returns the quaternion conjugate by default - the
45vector part is negated not the complex part of the components. To obtain the
46complex conjugate a second parameter is needed. There is also a total conjugate,
47which means both the quaternion and complex conjugates are applied. The reason
48for making the default the quaternion conjugate is subtle: conj is used in
49ctranspose and in inverse, and in both of these cases it must be the quaternion
50conjugate. Therefore for consistency, conj is the quaternion conjugate. The use
51of a different name (e.g. qconj) was considered but the problem of the '
52operator (conjugate transpose) would remain. It is clear that this operator
53should implement the quaternion conjugate transpose because it is this transpose
54that is needed most often and not the complex conjugate transpose. We can't
55introduce a new operator into Matlab. If we want a complex conjugate transpose
56we have to write conj(A.', 'complex').
57
58Steve Sangwine
59Nicolas Le Bihan
60
61Email: S.Sangwine@IEEE.org, nicolas.le-bihan@lis.inpg.fr
62
63LIS, Grenoble
64July 2005
65Amended March 2006
Note: See TracBrowser for help on using the repository browser.