source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/qtfm/@quaternion/private/mdot.m @ 37

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

Added original make3d

File size: 884 bytes
Line 
1function d = mdot(a, b)
2% Matrix dot (scalar) product. Like dot, but matrix not elementwise.
3
4% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
5% See the file : Copyright.m for further details.
6
7error(nargchk(2, 2, nargin)), error(nargoutchk(0, 1, nargout))
8
9if ~isa(a, 'quaternion') | ~isa(b, 'quaternion')
10    error('mdot product is not defined for a quaternion and a non-quaternion.')
11end
12
13% This function is defined for full and pure quaternions, and combinations
14% of full and pure, in which case we assume a zero scalar part for the pure
15% argument.
16
17if ispure(a) | ispure(b)
18    % This covers the case where either or both are pure. We can ignore the
19    % scalar part of the other, since it is implicitly multiplied by zero.
20   
21    d =               x(a) * x(b) + y(a) * y(b) + z(a) * z(b);
22else
23    d = s(a) * s(b) + x(a) * x(b) + y(a) * y(b) + z(a) * z(b);
24end
Note: See TracBrowser for help on using the repository browser.