/usr/share/octave/site/m/vlfeat/toolbox/aib/vl_aibcuthist.m is in octave-vlfeat 0.9.20+dfsg0-1.
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 | function hist = vl_aibcuthist(map, x, varargin)
% VL_AIBCUTHIST Compute a histogram by using an AIB compressed alphabet
% HIST = VL_AIBCUTHIST(MAP, X) computes the histogram of the data X
% using the compressed alphabet specified by a cut MAP of the AIB
% tree (as returned by VL_AIBCUT()). Each element of HIST counts how
% many elements of X are projected to the corresponding cut node
% (encoding the compressed alphabet).
%
% Data are mapped to bins as specified by VL_AIBCUTPUSH(). Data mapped
% to the null node are dropped.
%
% VL_AIBCUTHIST() accepts the following options:
%
% Nulls:: [drop]
% What to do of null nodes: drop ('drop'), accumulate to an
% extra bin at the end of HIST ('append'), or accumulate to
% the first bin ('first')
%
% See also: VL_AIB(), VL_HELP().
% Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
mode = 'drop' ;
for k=1:2:length(varargin)
opt=varargin{k} ;
arg=varargin{k+1} ;
switch lower(opt)
case 'nulls'
switch lower(arg)
case 'drop'
mode = 'drop' ;
case 'append'
mode = 'append' ;
case 'first'
mode = 'first' ;
otherwise
error(sprintf('Illegal argument ''%s'' for ''Nulls''', arg)) ;
end
otherwise
error(sprintf('Unknown option ''%''', opt)) ;
end
end
% determine cut size
cut_size = max(map) ;
% relabel data
y = vl_aibcutpush(map, x) ;
% null?
if any(y == 0)
switch mode
case 'drop'
y = y(y ~= 0) ;
case 'append'
cut_size = cut_size + 1 ;
y(y == 0) = cut_size ;
case 'first'
y(y == 0) = 1 ;
end
end
% Now we have the nodes of the cut. Accumulate.
hist = zeros(1, cut_size) ;
hist = vl_binsum(hist, ones(size(y)), y) ;
|