This file is indexed.

/usr/share/octave/packages/communications-1.2.0/ricedeco.m is in octave-communications-common 1.2.0-2.

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
## Copyright (C) 2006 Muthiah Annamalai <muthiah.annamalai@uta.edu>
##
## 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} {} ricedeco (@var{code}, @var{K})
##
## Returns the Rice decoded signal vector using @var{code} and @var{K}.
## Compulsory K is need to be specified.
## A restrictions is that a signal set must strictly be non-negative.
## The value of code is a cell array of row-vectors which have the
## encoded rice value for a single sample. The Rice algorithm is
##  used to encode the "code" and only that can be meaningfully
## decoded. @var{code} is assumed to have been of format generated
## by the function @code{riceenco}.
##
## Reference: Solomon Golomb, Run length Encodings, 1966 IEEE Trans Info Theory
##
## An example of the use of @code{ricedeco} is
## @example
## @group
## ricedeco (riceenco (1:4, 2), 2)
##     @result{} [1 2 3 4]
## @end group
## @end example
## @seealso{riceenco}
## @end deftypefn

##
##
##! /usr/bin/octave -q
##A stress test routine
##for i=1:100
##  sig=abs(randint(1,10,[0,255]));
##  [code,k]=riceenco(sig)
##  sig_d=ricedeco(code,k)
##  if(isequal(sig_d,sig)!=1)
##    error("Some mistake in ricedeco/enco pair");
##  endif
##endfor
##

function sig_op = ricedeco (code, K)

  if (nargin != 2 || ! iscell (code))
    print_usage ();
  endif

  L = length (code);

  K_pow_2 = 2**K;

  if (K != 0)
    power_seq = [2.^((K-1):-1:0)];
    for j = 1:L
      word = code{j};
      idx = find (word == 0)(1);
      val = sum (word(1:idx));
      sig_op(j) = val * K_pow_2 + sum (word(idx+1:end) .* power_seq);
    endfor
  else
    for j = 1:L
      sig_op(j) = sum (code{j});
    endfor
  endif

endfunction

%!assert (ricedeco (riceenco (1:4, 2), 2), [1:4])

%% Test input validation
%!error ricedeco ()
%!error ricedeco (1)
%!error ricedeco (1, 2)
%!error ricedeco (1, 2, 3)