This file is indexed.

/usr/include/blitz/reduce.h is in libblitz0-dev 1:0.10-3.3.

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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
// -*- C++ -*-
/***************************************************************************
 * blitz/reduce.h        Reduction operators: sum, mean, min, max,
 *                       minIndex, maxIndex, product, count, any, all
 *
 * $Id$
 *
 * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
 *
 * This file is a part of Blitz.
 *
 * Blitz 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 3
 * of the License, or (at your option) any later version.
 *
 * Blitz 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 Blitz.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Suggestions:          blitz-devel@lists.sourceforge.net
 * Bugs:                 blitz-support@lists.sourceforge.net    
 *
 * For more information, please see the Blitz++ Home Page:
 *    https://sourceforge.net/projects/blitz/
 *
 ***************************************************************************/

#ifndef BZ_REDUCE_H
#define BZ_REDUCE_H

#include <blitz/blitz.h>
#include <blitz/numtrait.h>
#include <blitz/numinquire.h>
#include <blitz/tinyvec2.h>


//  The various reduce classes.
//  The prototype of the reset method is mandated by the class _bz_ReduceReset
//  in file array/reduce.h

BZ_NAMESPACE(blitz)

template<typename P_sourcetype, typename P_resulttype = BZ_SUMTYPE(P_sourcetype)>
class ReduceSum {
public:

    typedef P_sourcetype T_sourcetype;
    typedef P_resulttype T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceSum() { }

    bool operator()(const T_sourcetype& x,const int=0) const { 
        sum_ += x; 
        return true;
    }

    T_resulttype result(const int) const { return sum_; }

    void reset() const { sum_ = zero(T_resulttype()); }
 
    static const char* name() { return "sum"; }
 
protected:

    mutable T_resulttype sum_;
};

template<typename P_sourcetype, typename P_resulttype = BZ_FLOATTYPE(P_sourcetype)>
class ReduceMean {
public:

    typedef P_sourcetype T_sourcetype;
    typedef P_resulttype T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceMean() { }

    bool operator()(const T_sourcetype& x,const int=0) const { 
        sum_ += x; 
        return true;
    }

    T_resulttype result(const int count) const { return sum_ / count; }

    void reset() const { sum_ = zero(T_resulttype()); }

    static const char* name() { return "mean"; }

protected:

    mutable T_resulttype sum_;
};

template<typename P_sourcetype>
class ReduceMin {
public:

    typedef P_sourcetype T_sourcetype;
    typedef P_sourcetype T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceMin() { }

    bool operator()(const T_sourcetype& x,const int=0) const {
        if (x < min_)
            min_ = x;
        return true;
    }

    T_resulttype result(const int) const { return min_; }

    void reset() const { min_ = huge(P_sourcetype()); }

    static const char* name() { return "min"; }

protected:

    mutable T_resulttype min_;
};

template<typename P_sourcetype>
class ReduceMax {
public:

    typedef P_sourcetype T_sourcetype;
    typedef P_sourcetype T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceMax() { }

    bool operator()(const T_sourcetype& x,const int=0) const {
        if (x > max_)
            max_ = x;
        return true;
    }

    T_resulttype result(const int) const { return max_; }

    void reset() const { max_ = neghuge(P_sourcetype()); }

    static const char* name() { return "max"; }

protected:

    mutable T_resulttype max_;
};

template <typename T>
struct MinMaxValue {
    void operator=(const T& val) { min = max = val; }
    T min;
    T max;
};

template<typename P_sourcetype>
class ReduceMinMax {
public:

    typedef P_sourcetype              T_sourcetype;
    typedef MinMaxValue<P_sourcetype> T_resulttype;
    typedef T_resulttype              T_numtype;

    static const bool needIndex = false, needInit = true;

    ReduceMinMax() { }

    bool operator()(T_sourcetype x,const int=0) const {
        if (x > minmax_.max)
            minmax_.max = x;
        else if (x < minmax_.min)
            minmax_.min = x;
        return true;
    }

    T_resulttype result(int) { return minmax_; }

    void reset(P_sourcetype initialValue) const { minmax_ = initialValue; }

    static const char* name() { return "minmax"; }

protected:

    mutable T_resulttype minmax_;
};

template<typename P_sourcetype>
class ReduceMinIndex {
public:

    typedef P_sourcetype T_sourcetype;
    typedef int          T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = true, needInit = false;

    ReduceMinIndex() { }

    bool operator()(const T_sourcetype& x,const T_resulttype& index) const {
        if (x < min_) {
            min_ = x;
            index_ = index;
        }
        return true;
    }

    T_resulttype result(const int) const { return index_; }

    void reset(const T_resulttype& index) const { 
        min_ = huge(T_sourcetype());
        index_ = index;        
    }

    static const char* name() { return "minIndex"; }

protected:

    mutable T_sourcetype min_;
    mutable T_resulttype index_;
};

template<typename P_sourcetype, int N>
class ReduceMinIndexVector {
public:

    typedef P_sourcetype T_sourcetype;
    typedef TinyVector<int,N> T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = true, needInit = false;

    ReduceMinIndexVector() { }

    bool operator()(const T_sourcetype& x, const T_resulttype& index) const {
        if (x < min_) {
            min_ = x;
            index_ = index;
        }
        return true;
    }

    T_resulttype result(const int) const { return index_; }

    void reset(const T_resulttype& index) const {
        min_ = huge(T_sourcetype());
        index_ = index;
    }

    static const char* name() { return "minIndexVector"; }

protected:

    mutable T_sourcetype min_;
    mutable T_resulttype index_;
};

template<typename P_sourcetype>
class ReduceMaxIndex {
public:

    typedef P_sourcetype T_sourcetype;
    typedef int          T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = true, needInit = false;

    ReduceMaxIndex() { }

    bool operator()(const T_sourcetype& x,const T_resulttype& index) const {
        if (x > max_) {
            max_ = x;
            index_ = index;
        }
        return true;
    }

    T_resulttype result(int) const { return index_; }

    void reset(const T_resulttype& index) const {
        max_ = neghuge(T_sourcetype());
        index_ = index;
    }

    static const char* name() { return "maxIndex"; }

protected:

    mutable T_sourcetype max_;
    mutable T_resulttype index_;
};

template<typename P_sourcetype, int N_rank>
class ReduceMaxIndexVector {
public:

    typedef P_sourcetype T_sourcetype;
    typedef TinyVector<int,N_rank> T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = true, needInit = false;

    ReduceMaxIndexVector() { }

    bool operator()(const T_sourcetype& x, const T_resulttype& index) const {
        if (x > max_) {
            max_ = x;
            index_ = index;
        }
        return true;
    }

    T_resulttype result(const int) const { return index_; }

    void reset(const T_resulttype& index) const {
        max_ = neghuge(T_sourcetype());
        index_ = index;
    }

    static const char* name() { return "maxIndexVector"; }

protected:

    mutable T_sourcetype max_;
    mutable T_resulttype index_;
};

template<typename P_sourcetype>
class ReduceFirst {
public:

    typedef P_sourcetype T_sourcetype;
    typedef int          T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceFirst() { }

    bool operator()(const T_sourcetype& x,const T_resulttype& index) const {
        if (x) {
            index_ = index;
            return false;
        } else
            return true;
    }

    T_resulttype result(const int) const { return index_; }

    void reset() const { index_ = tiny(int()); }

    static const char* name() { return "first"; }

protected:

    mutable T_resulttype index_;
};

template<typename P_sourcetype>
class ReduceLast {
public:

    typedef P_sourcetype T_sourcetype;
    typedef int          T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceLast() { }

    bool operator()(const T_sourcetype& x,const T_resulttype& index) const {
        if (x) {
            index_ = index;
            return true;
        } else
            return true;
    }

    T_resulttype result(const int) const { return index_; }

    void reset() const { index_ = huge(int()); }

    static const char* name() { return "last"; }

protected:

    mutable T_resulttype index_;
};

template<typename P_sourcetype, typename P_resulttype = BZ_SUMTYPE(P_sourcetype)>
class ReduceProduct {
public:

    typedef P_sourcetype T_sourcetype;
    typedef P_resulttype T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceProduct() { }

    bool operator()(const T_sourcetype& x,const int=0) const { 
        product_ *= x; 
        return true;
    }

    T_resulttype result(const int) const { return product_; }

    void reset() const { product_ = one(T_resulttype()); }

    static const char* name() { return "product"; }

protected:

    mutable T_resulttype product_;
};

template<typename P_sourcetype>
class ReduceCount {
public:

    typedef P_sourcetype T_sourcetype;
    typedef int          T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceCount() { }

    bool operator()(const T_sourcetype& x,const int=0) const {
        if (bool(x))
            ++count_;
        return true;
    }

    T_resulttype result(const int) const { return count_; }

    void reset() const { count_ = zero(T_resulttype()); }

    static const char* name() { return "count"; }

protected:

    mutable T_resulttype count_;
};

template<typename P_sourcetype>
class ReduceAny {
public:

    typedef P_sourcetype T_sourcetype;
    typedef bool     T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceAny() { }

    bool operator()(const T_sourcetype& x,const int=0) const {
        if (bool(x)) {
            any_ = true;
            return false;
        }

        return true;
    }

    T_resulttype result(const int) const { return any_; }

    void reset() const { any_ = false; }

    static const char* name() { return "any"; }

protected:

    mutable T_resulttype any_;
};

template<typename P_sourcetype>
class ReduceAll {
public:

    typedef P_sourcetype T_sourcetype;
    typedef bool     T_resulttype;
    typedef T_resulttype T_numtype;

    static const bool needIndex = false, needInit = false;

    ReduceAll() { }

    bool operator()(const T_sourcetype& x,const int=0) const {
        if (!bool(x)) {
            all_ = false;
            return false;
        } else
            return true;
    }

    T_resulttype result(const int) const { return all_; }

    void reset() const { all_ = true; }

    static const char* name() { return "all"; }

protected:

    mutable T_resulttype all_;
}; 

BZ_NAMESPACE_END

#endif // BZ_REDUCE_H