1 ## Copyright (C) 2002 David Bateman
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} {} fft (@var{x})
19 ## If @var{x} is a column vector, finds the FFT over the primitive element
20 ## of the Galois Field of @var{x}. If @var{x} is in the Galois Field
21 ## GF(2^@var{m}), then @var{x} must have @code{2^@var{m} - 1} elements.
27 error ("usage: y = fft (x)");
31 error("fft: argument must be a galois variable");
36 error ([ "fft: argument must be in Galois Field GF(2^m), where", ...
37 " m is not greater than 8"]);
40 alph = gf(2, x.m, x.prim_poly);
42 if ((nc == 1) && (nr == n))
44 elseif ((nc == n) && (nr == 1))
45 y = (dftmtx(alph) * x')';
47 error ("fft: argument must be a vector in GF(2^m) of length 2^m-1");