This file is indexed.

/usr/share/octave/packages/control-3.0.0/issample.m is in octave-control 3.0.0-5.

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
## Copyright (C) 1996, 2000, 2002, 2003, 2004, 2005, 2007
##               Auburn University.  All rights reserved.
##
## 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} {@var{bool} =} issample (@var{ts})
## @deftypefnx {Function File} {@var{bool} =} issample (@var{ts}, @var{flg})
## Return true if @var{ts} is a valid sampling time.
##
## @strong{Inputs}
## @table @var
## @item ts
## Alleged sampling time to be tested.
## @item flg = 1
## Accept real scalars @var{ts} > 0.  Default Value.
## @item flg = 0
## Accept real scalars @var{ts} >= 0.
## @item flg = -1
## Accept real scalars @var{ts} > 0 and @var{ts} == -1.
## @item flg = -10
## Accept real scalars @var{ts} >= 0 and @var{ts} == -1.
## @item flg = -2
## Accept real scalars @var{ts} >= 0, @var{ts} == -1 and @var{ts} == -2.
## @end table
##
## @strong{Outputs}
## @table @var
## @item bool
## True if conditions are met and false otherwise.
## @end table
##
## @end deftypefn

## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
## Created: July 1995

## Adapted-By: Lukas Reichlin <lukas.reichlin@gmail.com>
## Date: September 2009
## Version: 0.3

function bool = issample (tsam, flg = 1)

  if (nargin < 1 || nargin > 2)
    print_usage (); 
  endif

  switch (flg)
    case 1    # discrete
      bool = is_real_scalar (tsam) && (tsam > 0);
    case 0    # continuous or discrete
      bool = is_real_scalar (tsam) && (tsam >= 0);
    case -1   # discrete, tsam unspecified
      bool = is_real_scalar (tsam) && (tsam > 0 || tsam == -1);
    case -10  # continuous or discrete, tsam unspecified
      bool = is_real_scalar (tsam) && (tsam >= 0 || tsam == -1);
    case -2   # accept static gains
      bool = is_real_scalar (tsam) && (tsam >= 0 || tsam == -1 || tsam == -2);
    otherwise
      print_usage ();
  endswitch

endfunction


## flg == 1
%!assert (issample (1))
%!assert (issample (pi))
%!assert (issample (0), false)
%!assert (issample (-1), false)
%!assert (issample (-1, 1), false)
%!assert (issample ("a"), false)
%!assert (issample (eye (2)), false)
%!assert (issample (2+2i), false)

## flg == 0
%!assert (issample (1, 0))
%!assert (issample (0, 0))
%!assert (issample (-1, 0), false)
%!assert (issample (pi, 0))
%!assert (issample ("b", 0), false)
%!assert (issample (rand (3,2), 0), false)
%!assert (issample (2+2i, 0), false)
%!assert (issample (0+2i, 0), false)

## flg == -1
%!assert (issample (-1, -1))
%!assert (issample (0, -1), false)
%!assert (issample (1, -1))
%!assert (issample (pi, -1))
%!assert (issample (-pi, -1), false)
%!assert (issample ("b", -1), false)
%!assert (issample (rand (3,2), -1), false)
%!assert (issample (-2+2i, -1), false)

## errors
%!error (issample (-1, "ab"))
%!error (issample ())
%!error (issample (-1, -1, -1))
%!error (issample (1, pi))
%!error (issample (5, rand (2,3)))
%!error (issample (0, 1+2i))