This file is indexed.

/usr/share/slsh/local-packages/histogram.sl is in slang-histogram 0.3.2a-4.

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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
% This file not only provides access to the module, it also provides several
% other functions that are easier to implement in slang.  These include:
%
%   whist1d     : weighted 1-d histogram
%   whist2d     : weighted 2-d histogram
%   hist2d_rebin: Rebins a 2-d histogram
%
#ifeval _slang_version < 20000
if (current_namespace () != "")
  import ("histogram", current_namespace ());
else
#endif
 import ("histogram");

define whist1d ()
{
   variable func = NULL;
   variable rev = NULL;

   switch (_NARGS)
     {
      case 4:
	rev = ();
     }
     {
      case 5:
	(rev, func) = ();
     }
     {
	if (_NARGS != 3)
	  usage ("h = %s (pnts, weights, bin-edges [,rev-indices [,func]])", 
		 _function_name);
     }
   
   variable pnts, w, edges;
   (pnts, w, edges) = ();
   
   if (func == NULL)
     func = &sum;

   variable r;
   () = hist1d (pnts, edges, &r);
   
   variable n = length (edges);
   variable h = Double_Type [n];

   _for (0, n-1, 1)
     {
	variable i = ();
	h[i] = (@func) (w[r[i]]);
     }

   if (rev != NULL)
     @rev = r;
   
   return h;
}

define whist2d ()
{
   variable rev = NULL, func = NULL;
   switch (_NARGS)
     {
      case 6:
	rev = ();
     }
     {
      case 7:
	(rev, func) = ();
     }
     {
	if (_NARGS != 5)
	  usage ("img=%s(xpnts, ypnts, weights, xgrid, ygrid [,rev [,func]])",
		 _function_name ());
     }

   variable x, y, w, xgrid, ygrid;
   (x, y, w, xgrid, ygrid) = ();

   if (func == NULL)
     func = &sum;

   variable r; 
   () = hist2d (x, y, xgrid, ygrid, &r);

   variable nx = length (xgrid);
   variable ny = length (ygrid);
   variable img = Double_Type[nx, ny];
   _for (0, nx-1, 1)
     {
	variable i = ();
	_for (0, ny-1, 1)
	  {
	     variable j = ();
	     img[i,j] = (@func)(w[r[i,j]]);
	  }
     }

   if (rev != NULL)
     @rev = r;

   return img;
}

define hist2d_rebin ()
{
   if (_NARGS != 5)
     usage ("new_ijhist=%s(new_igrid,new_jgrid,old_igrid,old_jgrid,old_ijhist)",
	    _function_name);

   variable new_igrid, new_jgrid, old_igrid, old_jgrid, old_hist;
   (new_igrid, new_jgrid, old_igrid, old_jgrid, old_hist) = ();
   
   variable new_ilen = length (new_igrid);
   variable new_jlen = length (new_jgrid);
   variable old_ilen = length (old_igrid);
   variable old_jlen = length (old_jgrid);
   
   variable h_i = hist1d_rebin (new_jgrid, old_jgrid, old_hist[0,*]);
   variable type = _typeof (h_i);
   
   variable new_hist = @Array_Type (type, [old_ilen, new_jlen]);
   
   new_hist[0,*] = h_i;
   _for (1, old_ilen-1, 1)
     {
	variable i = ();
	new_hist[i,*] = hist1d_rebin (new_jgrid, old_jgrid, old_hist[i,*]);
     }
   old_hist = new_hist;
   new_hist = @Array_Type (type, [new_ilen, new_jlen]);
   
   _for (0, new_jlen-1, 1)
     {
	variable j = ();
	new_hist[*,j] = hist1d_rebin (new_igrid, old_igrid, old_hist[*,j]);
     }
   
   return new_hist;
}


#ifexists add_doc_file
$1 = path_concat (path_concat (path_dirname (__FILE__), "help"),
		  "histogram.hlp");
if (NULL != stat_file ($1))
  add_doc_file ($1);
#endif

provide ("histogram");