This file is indexed.

/usr/include/gmm/gmm_algobase.h is in libgmm-dev 4.0.0-0ubuntu1.

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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// -*- c++ -*- (enables emacs c++ mode)
//===========================================================================
//
// Copyright (C) 2000-2008 Yves Renard
//
// This file is a part of GETFEM++
//
// Getfem++  is  free software;  you  can  redistribute  it  and/or modify it
// under  the  terms  of the  GNU  Lesser General Public License as published
// by  the  Free Software Foundation;  either version 2.1 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 Lesser General Public
// License for more details.
// You  should  have received a copy of the GNU Lesser General Public License
// along  with  this program;  if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
//
// As a special exception, you  may use  this file  as it is a part of a free
// software  library  without  restriction.  Specifically,  if   other  files
// instantiate  templates  or  use macros or inline functions from this file,
// or  you compile this  file  and  link  it  with other files  to produce an
// executable, this file  does  not  by itself cause the resulting executable
// to be covered  by the GNU Lesser General Public License.  This   exception
// does not  however  invalidate  any  other  reasons why the executable file
// might be covered by the GNU Lesser General Public License.
//
//===========================================================================

/** @file gmm_algobase.h 
   @author  Yves Renard <Yves.Renard@insa-lyon.fr>
   @date September 28, 2000.
    @brief Miscelleanous algorithms on containers.
*/

#ifndef GMM_ALGOBASE_H__
#define GMM_ALGOBASE_H__
#include "gmm_std.h"
#include "gmm_except.h"
#include <functional>

namespace gmm {

  /* ********************************************************************* */
  /* Definitition de classes de comparaison.                               */
  /* retournant un int.                                                    */
  /* ********************************************************************* */
  
  template <class T>
    struct less : public std::binary_function<T, T, int> {
    inline int operator()(const T& x, const T& y) const
    { return (x < y) ? -1 : ((y < x) ? 1 : 0); }
  };

  template<> struct less<int> : public std::binary_function<int, int, int>
  { int operator()(int x, int y) const { return x-y; } };
  template<> struct less<char> : public std::binary_function<char, char, int>
  { int operator()(char x, char y) const { return int(x-y); } };
  template<> struct less<short> : public std::binary_function<short,short,int>
  { int operator()(short x, short y) const { return int(x-y); } };
  template<> struct less<unsigned char>
     : public std::binary_function<unsigned char, unsigned char, int> {
    int operator()(unsigned char x, unsigned char y) const
    { return int(x)-int(y); }
  };
  

  template <class T>
    struct greater : public std::binary_function<T, T, int> {
    inline int operator()(const T& x, const T& y) const
    { return (y < x) ? -1 : ((x < y) ? 1 : 0); }
  };

  template<> struct greater<int> : public std::binary_function<int, int, int>
  { int operator()(int x, int y) const { return y-x; } };
  template<> struct greater<char> : public std::binary_function<char,char,int>
  { int operator()(char x, char y) const { return int(y-x); } };
  template<> struct greater<short>
      : public std::binary_function<short, short, int>
  { int operator()(short x, short y) const { return int(y-x); } };
  template<> struct greater<unsigned char>
    : public std::binary_function<unsigned char, unsigned char, int> {
    int operator()(unsigned char x, unsigned char y) const
      { return int(y)-int(x); }
  };

  template <typename T> inline T my_abs(T a) { return (a < T(0)) ? T(-a) : a; }
  
  template <class T>
    struct approx_less : public std::binary_function<T, T, int> { 
    double eps;
    inline int operator()(const T &x, const T &y) const
    { if (my_abs(x - y) <= eps) return 0; if (x < y) return -1; return 1; }
    approx_less(double e = 1E-13) { eps = e; }
  };

  template <class T>
    struct approx_greater : public std::binary_function<T, T, int> { 
    double eps;
    inline int operator()(const T &x, const T &y) const
    { if (my_abs(x - y) <= eps) return 0; if (x > y) return -1; return 1; }
    approx_greater(double e = 1E-13) { eps = e; }
  };

  template<class ITER1, class ITER2, class COMP>
    int lexicographical_compare(ITER1 b1, const ITER1 &e1,
				ITER2 b2, const ITER2 &e2, const COMP &c)  {
    int i;
    for ( ; b1 != e1 && b2 != e2; ++b1, ++b2)
      if ((i = c(*b1, *b2)) != 0) return i;
    if (b1 != e1) return 1; if (b2 != e2) return -1; return 0; 
  }

  template<class CONT, class COMP = gmm::less<typename CONT::value_type> >
    struct lexicographical_less : public std::binary_function<CONT, CONT, int>
  { 
    COMP c;
    int operator()(const CONT &x, const CONT &y) const {
      return gmm::lexicographical_compare(x.begin(), x.end(),
					  y.begin(), y.end(), c);
    }
    lexicographical_less(const COMP &d = COMP()) { c = d; }
  };

  template<class CONT, class COMP = gmm::less<typename CONT::value_type> >
  struct lexicographical_greater
    : public std::binary_function<CONT, CONT, int> { 
    COMP c;
    int operator()(const CONT &x, const CONT &y) const {
      return -gmm::lexicographical_compare(x.begin(), x.end(),
					   y.begin(), y.end(), c);
    }
    lexicographical_greater(const COMP &d = COMP()) { c = d; }
  };
  

  /* ********************************************************************* */
  /* "Virtual" iterators on sequences.                                     */
  /* The class T represent a class of sequence.                            */
  /* ********************************************************************* */

  template<class T> struct sequence_iterator {
    
    typedef T             value_type;
    typedef value_type*   pointer;
    typedef value_type&   reference;
    typedef const value_type& const_reference;
    typedef std::forward_iterator_tag iterator_category;

    T Un;

    sequence_iterator(T U0 = T(0)) { Un = U0; }
    
    sequence_iterator &operator ++()
    { ++Un; return *this; }
    sequence_iterator operator ++(int)
    { sequence_iterator tmp = *this; (*this)++; return tmp; }
	
    const_reference operator *() const { return Un; }
    reference operator *() { return Un; }
    
    bool operator ==(const sequence_iterator &i) const { return (i.Un==Un);}
    bool operator !=(const sequence_iterator &i) const { return (i.Un!=Un);}
  };

  /* ********************************************************************* */
  /* generic algorithms.                                                   */
  /* ********************************************************************* */

  template <class ITER1, class SIZE, class ITER2>
  ITER2 copy_n(ITER1 first, SIZE count, ITER2 result) {
    for ( ; count > 0; --count, ++first, ++result) *result = *first;
    return result;
  }

  template<class ITER>
    typename std::iterator_traits<ITER>::value_type
      mean_value(ITER first, const ITER &last) {
    GMM_ASSERT2(first != last, "mean value of empty container");
    size_t n = 1;
    typename std::iterator_traits<ITER>::value_type res = *first++;
    while (first != last) { res += *first; ++first; ++n; }
    res /= float(n);
    return res;
  }

  template<class CONT>
    typename CONT::value_type
  mean_value(const CONT &c) { return mean_value(c.begin(), c.end()); }

  template<class ITER> /* hum ... */
    void minmax_box(typename std::iterator_traits<ITER>::value_type &pmin,
		    typename std::iterator_traits<ITER>::value_type &pmax,
		    ITER first, const ITER &last) {
    typedef typename std::iterator_traits<ITER>::value_type PT;
    if (first != last) { pmin = pmax = *first; ++first; }
    while (first != last) {
      typename PT::const_iterator b = (*first).begin(), e = (*first).end();
      typename PT::iterator b1 = pmin.begin(), b2 = pmax.begin();
      while (b != e)
	{ *b1 = std::min(*b1, *b); *b2 = std::max(*b2, *b); ++b; ++b1; ++b2; }
    }
  }

  template<typename VEC> struct sorted_indexes_aux {
    const VEC &v;
  public:
    sorted_indexes_aux(const VEC& v_) : v(v_) {}
    template <typename IDX>
    bool operator()(const IDX &ia, const IDX &ib) const
    { return v[ia] < v[ib]; }
  };

  template<typename VEC, typename IVEC> 
  void sorted_indexes(const VEC &v, IVEC &iv) {
    iv.clear(); iv.resize(v.size());
    for (size_t i=0; i < v.size(); ++i) iv[i] = i;
    std::sort(iv.begin(), iv.end(), sorted_indexes_aux<VEC>(v));
  }

}


#endif /* GMM_ALGOBASE_H__ */