This file is indexed.

/usr/share/octave/packages/nan-2.5.9/mean.m is in octave-nan 2.5.9-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
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
function [y]=mean(x,DIM,opt,W)
% MEAN calculates the mean of data elements. 
% 
%  y = mean(x [,DIM] [,opt] [, W])
%
% DIM	dimension
%	1 MEAN of columns
%	2 MEAN of rows
% 	N MEAN of  N-th dimension 
%	default or []: first DIMENSION, with more than 1 element
%
% opt	options 
%	'A' arithmetic mean
%	'G' geometric mean
%	'H' harmonic mean
%
% W	weights to compute weighted mean (default: [])
%	if W=[], all weights are 1. 
%	number of elements in W must match size(x,DIM) 
%
% usage: 
%	mean(x)
%	mean(x,DIM)
%	mean(x,opt)
%	mean(x,opt,DIM)
%	mean(x,DIM,opt)
%	mean(x,DIM,W)
%	mean(x,DIM,opt,W); '
%
% features:
% - can deal with NaN's (missing values)
% - weighting of data 
% - dimension argument also in Octave
% - compatible to Matlab and Octave
%
% see also: SUMSKIPNAN, MEAN, GEOMEAN, HARMMEAN
%

%	$Id: mean.m 9033 2011-11-08 20:58:07Z schloegl $
%	Copyright (C) 2000-2004,2008,2009,2011 by Alois Schloegl <alois.schloegl@gmail.com>	
%    	This is part of the NaN-toolbox. For more details see
%       http://pub.ist.ac.at/~schloegl/matlab/NaN/
%
%    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/>.

if nargin==1,
	%------ case:  mean(x)
	W = []; 
        DIM=[]; 
        opt='a';
elseif (nargin==2)
	W = []; 
        %if ~isnumeric(DIM), %>=65;%abs('A'), 
        if (DIM>64) %abs('A'), 
		%------ case:  mean(x,opt)
                opt=DIM;
                DIM=[]; 
        else
		%------ case:  mean(x,DIM)
                opt='a';
        end;	
elseif (nargin == 3), 
        if isnumeric(DIM) && isnumeric(opt)
		%------ case:  mean(x,DIM,W)
		W = opt; 
		opt='a';
	elseif (DIM>64) %abs('A'), 
		%------ case:  mean(x,opt,DIM)
        	%if ~isnumeric(DIM), %>=65;%abs('A'), 
                tmp=opt;
                opt=DIM;
                DIM=tmp;
                W = []; 
        else 
        	%------ case:  mean(x,DIM,opt)
        	W = [];
        end;
elseif nargin==4,
		%------ case: mean(x,DIM,opt,W)
	; 
else
	help mean 
%	fprintf(1,'usage: mean(x) or mean(x,DIM) or mean(x,opt,DIM) or mean(x,DIM,opt) or mean(x,DIM,W) or mean(x,DIM,opt,W); '
end;

if isempty(opt)
	opt = 'A';
elseif any(opt=='aAgGhH')
	opt = upper(opt); % eliminate old version 
else 
	error('Error MEAN: invalid opt argument');
end; 

if  (opt == 'A')
	[y, n] = sumskipnan(x,DIM,W);
        y = y./n;
elseif (opt == 'G')
	[y, n] = sumskipnan(log(x),DIM,W);
    	y = exp (y./n);
elseif (opt == 'H')
	[y, n] = sumskipnan(1./x,DIM,W);
    	y = n./y;
else
    	fprintf (2,'mean:  option `%s` not recognized', opt);
end 

%!assert(mean([1,NaN],1),[1,NaN])
%!assert(mean([1,NaN],2),1)
%!assert(mean([+inf,-inf]),NaN)
%!assert(mean([+0,-0],'h'),NaN)
%!assert(mean([1,4,NaN],'g'),2)