This file is indexed.

/usr/share/octave/packages/symbolic-2.6.0/heaviside.m is in octave-symbolic 2.6.0-3build1.

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
%% Copyright (C) 2006 Sylvain Pelissier <sylvain.pelissier@gmail.com>
%% Copyright (C) 2015-2016 Colin B. Macdonald <cbm@m.fsf.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 -*-
%% @documentencoding UTF-8
%% @defun  heaviside (@var{x})
%% @defunx heaviside (@var{x}, @var{zero_value})
%% Compute the Heaviside unit-step function.
%%
%% The Heaviside function is 0 for negative @var{x} and 1 for
%% positive @var{x}.
%%
%% Example:
%% @example
%% @group
%% heaviside([-inf -3 -1 1 3 inf])
%%   @result{} 0     0     0     1     1     1
%% @end group
%% @end example
%%
%% There are various conventions for @code{heaviside(0)}; this
%% function returns 0.5 by default:
%% @example
%% @group
%% heaviside(0)
%%   @result{} 0.50000
%% @end group
%% @end example
%% However, this can be changed via the optional second input
%% argument:
%% @example
%% @group
%% heaviside(0, 1)
%%   @result{} 1
%% @end group
%% @end example
%% @seealso{dirac, @@sym/heaviside}
%% @end defun

function y = heaviside (x, zero_value)
  if (nargin < 1 || nargin > 2)
    print_usage ();
  end
  if (nargin == 1)
    zero_value = 0.5;
  end

  if (~isreal (x))
    error ('heaviside: X must not contain complex values');
  end

  y = cast (x > 0, class (x));
  y(x == 0) = zero_value;

  y(isnan (x)) = NaN;
end


%!assert (heaviside (0) == 0.5)
%!assert (isnan (heaviside (nan)))
%!assert (isequal (heaviside ([-inf -eps 0 eps inf]), [0 0 0.5 1 1]))
%!assert (isequaln (heaviside ([-1 1 nan]), [0 1 nan]))
%!assert (heaviside (0, 1) == 1)
%!error <complex values> heaviside (1i)
%!assert (isa (heaviside (single (0)), 'single'))