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

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

Added original make3d

File size: 1.5 KB
Line 
1function Y = qdft(X, A, L)
2% QDFT Discrete quaternion Fourier transform.
3%
4% This function computes the one-dimensional discrete quaternion Fourier
5% transform of (columns of) X, which may be a real or complex quaternion
6% array. A is the transform axis and it may be a real or complex pure
7% quaternion. It need not be a unit pure quaternion. L may take the values
8% 'L' or 'R' according to whether the hypercomplex exponential is to be
9% multiplied on the left or right of X. There are no default values.
10%
11% This function uses direct evaluation using a matrix product, and it is
12% intended mainly for verifying results against fast transform
13% implementations such as qfft.m. See also: iqdft.m.
14
15% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
16% See the file : Copyright.m for further details.
17
18error(nargchk(3, 3, nargin)), error(nargoutchk(0, 1, nargout))
19
20if size(A) ~= [1, 1]
21    error('The transform axis cannot be a matrix or vector.');
22end
23
24if ~isa(A, 'quaternion') | ~ispure(A)
25    error('The transform axis must be a pure quaternion.')
26end
27
28if L ~= 'L' & L ~= 'R'
29    error('L must have the value ''L'' or ''R''.');
30end
31
32A = unit(A); % Ensure that A is a unit (pure) quaternion.
33
34[r,c] = size(X);
35
36E = exp(-A .* 2 .* pi .* ((0:r-1)' *(0:r-1)) ./r);
37
38if L == 'L'
39    Y = E * X; % Multiply the exponential matrix on the left.
40elseif L == 'R'
41    Y = (X.' * E.').'; % To multiply the exponential matrix on the right
42                       % we transpose both and transpose the result.
43else
44    error('L has incorrect value');
45end
Note: See TracBrowser for help on using the repository browser.