This file is indexed.

/usr/share/octave/packages/signal-1.3.0/fwht.m is in octave-signal 1.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
## Copyright (C) 2013 Mike Miller <mtmiller@ieee.org>
##
## This program is free software: you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation, either version 3 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn  {Function File} {} fwht (@var{x})
## @deftypefnx {Function File} {} fwht (@var{x}, @var{n})
## @deftypefnx {Function File} {} fwht (@var{x}, @var{n}, @var{order})
## Compute the Walsh-Hadamard transform of @var{x} using the Fast
## Walsh-Hadamard Transform (FWHT) algorithm.  If the input is a matrix,
## the FWHT is calculated along the columns of @var{x}.
##
## The number of elements of @var{x} must be a power of 2; if not, the
## input will be extended and filled with zeros.  If a second argument
## is given, the input is truncated or extended to have length @var{n}.
##
## The third argument specifies the @var{order} in which the returned
## Walsh-Hadamard transform coefficients should be arranged.  The
## @var{order} may be any of the following strings:
##
## @table @asis
## @item "sequency"
## The coefficients are returned in sequency order.  This is the default
## if @var{order} is not given.
##
## @item "hadamard"
## The coefficients are returned in Hadamard order.
##
## @item "dyadic"
## The coefficients are returned in Gray code order.
## @end table
##
## @seealso{ifwht}
## @end deftypefn

## Author: Mike Miller

function y = fwht (x, n, order)

  if (nargin < 1 || nargin > 3)
    print_usage ();
  elseif (nargin == 1)
    n = order = [];
  elseif (nargin == 2)
    order = [];
  endif

  [y, n] = __fwht_opts__ ("fwht", x, n, order);
  y /= n;

endfunction

%!assert (isempty (fwht ([])));
%!assert (fwht (zeros (16)), zeros (16));
%!assert (fwht (ones (16, 1)), [1; (zeros (15, 1))]);
%!assert (fwht (zeros (17, 1)), zeros (32, 1));
%!assert (fwht ([1 -1 1 -1 1 -1 1 -1]), [0 0 0 0 0 0 0 1]);

%!test
%! x = randi (16, 16);
%! assert (ifwht (fwht (x)), x);
%!test
%! x = randi (16, 16);
%! assert (ifwht (fwht (x, [], "sequency"), [], "sequency"), x);
%!test
%! x = randi (16, 16);
%! assert (ifwht (fwht (x, [], "hadamard"), [], "hadamard"), x);
%!test
%! x = randi (16, 16);
%! assert (ifwht (fwht (x, [], "dyadic"), [], "dyadic"), x);

%% Test input validation
%!error fwht ();
%!error fwht (1, 2, 3, 4);
%!error fwht (0, 0);
%!error fwht (0, 5);
%!error fwht (0, [], "invalid");