/usr/share/octave/packages/interval-2.1.0/@infsupdec/bisect.m is in octave-interval 2.1.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 | ## Copyright 2015-2016 Oliver Heimlich
##
## 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 -*-
## @documentencoding UTF-8
## @deftypemethod {@@infsupdec} {[@var{A}, @var{B}] =} bisect (@var{X})
##
## Bisect an interval into two intervals, which contain half the amount of
## binary64 numbers each.
##
## Instead of bisecting the values of numbers in the interval at
## @code{mid (@var{X})}, this function bisects a function that counts them. In
## a bisect method this eliminates exactly half of the solutions and avoids
## slow convergence speeds in extreme cases.
##
## If all numbers in interval @var{X} are of equal sign, the pivot element used
## for bisection is @code{pow2 (mid (log2 (abs (@var{X}))))}. If @var{X} is no
## empty interval, the intervals @var{A} and @var{B} are non-empty and satisfy
## @code{@var{A}.sup == @var{B}.inf}.
##
## @comment DO NOT SYNCHRONIZE DOCUMENTATION STRING
## The function is a set operation and the result carries the @code{trv}
## decoration at best.
##
## @example
## @group
## [a, b] = bisect (infsupdec (2, 32))
## @result{}
## a = [2, 8]_trv
## b = [8, 32]_trv
## @end group
## @end example
## @seealso{@@infsupdec/nextout}
## @end deftypemethod
## Author: Oliver Heimlich
## Keywords: interval
## Created: 2015-05-25
function [a, b] = bisect (x)
if (nargin > 1)
print_usage ();
return
endif
## bisect must not retain any useful decoration
[a, b] = bisect (x.infsup);
a = infsupdec (a, "trv");
b = infsupdec (b, "trv");
a.dec(isnai (x)) = b.dec(isnai (x)) = _ill ();
endfunction
%!# from the documentation string
%!test
%! [a, b] = bisect (infsupdec (2, 32));
%! assert (a == infsupdec (2, 8, "trv"));
%! assert (b == infsupdec (8, 32, "trv"));
|