This file is indexed.

/usr/share/octave/packages/specfun-1.1.0/multinom_exp.m is in octave-specfun 1.1.0-1build1.

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
89
90
91
92
%% Copyright (c) 2011 Jordi GutiƩrrez Hermoso <jordigh@octave.org>
%% Copyright (c) 2011 Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
%%
%%    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
%%    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} {@var{alpha} =} multinom_exp (@var{m}, @var{n})
%% @deftypefnx {Function File} {@var{alpha} =} multinom_exp (@var{m}, @var{n},@var{sort})
%% Returns the exponents of the terms in the multinomial expansion
%% @tex
%% $$
%% (x_1 + x_2 + ... + x_m).^n
%% $$
%% @end tex
%% @ifnottex
%%
%% @example
%% (x1 + x2 + ... + xm).^@var{n}
%% @end example
%%
%% @end ifnottex
%%
%% For example, for m=2, n=3 the expansion has the terms
%% @tex
%% $$
%% x1^3, x2^3, x1^2*x2, x1*x2^2
%% $$
%% @end tex
%% @ifnottex
%%
%% @example
%% x1^3, x2^3, x1^2*x2, x1*x2^2
%% @end example
%%
%% @end ifnottex
%%
%% then @code{alpha = [3 0; 2 1; 1 2; 0 3]};
%%
%% The optional argument @var{sort} is passed to function @code{sort} to
%% sort the exponents by the maximum degree.
%% The example above calling @code{ multinom(m,n,"ascend")} produces
%%
%% @code{alpha = [2 1; 1 2; 3 0; 0 3]};
%%
%% calling @code{ multinom(m,n,"descend")} produces
%%
%% @code{alpha = [3 0; 0 3; 2 1; 1 2]};
%%
%% @seealso{multinom, multinom_coeff, sort}
%% @end deftypefn

function alpha = multinom_exp(m, n, sortmethod)

     %% This is standard stars and bars.
     numsymbols = m+n-1;
     stars = nchoosek (1:numsymbols, n);

     %% Star labels minus their consecutive position becomes their index
     %% position!
     idx  = bsxfun (@minus, stars, [0:n-1]);

     %% Manipulate indices into the proper shape for accumarray.
     nr   = size (idx, 1);
     a    = repmat ([1:nr], n, 1);
     b    = idx';
     idx  = [a(:), b(:)];

     alpha = accumarray (idx, 1);

     if nargin > 2
        [~, idx] = sort (max (alpha, [], 2), 1, sortmethod);
        alpha    = alpha(idx, :);
     end
end

%!demo
%! m=2;
%! n=3;
%! alpha = multinom_exp(m,n)
%! alpha_asc = multinom_exp(m,n,'ascend')
%! alpha_dec = multinom_exp(m,n,'descend')