This file is indexed.

/usr/include/linbox/algorithms/cra-kaapi.h is in liblinbox-dev 1.1.6~rc0-4.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
 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
/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* author: B. David Saunders and Zhendong Wan*/
// parallelized for BOINC computing by Bryan Youse
// ======================================================================= //
// Time-stamp: <09 Feb 07 17:10:21 Jean-Guillaume.Dumas@imag.fr> 
// ======================================================================= //
#ifndef __LINBOX_CRA_KAAPI_H
#define __LINBOX_CRA_KAAPI_H

#include <vector>
#include <cstdlib>
#include <utility>

#include "linbox/util/timer.h"
#include "linbox/integer.h"
#include "linbox/solutions/methods.h"

#include "linbox/kaapi/communicate.h"

namespace LinBox {

    /**************************************************************************************************
     * CRA loop subroutine
     * given a function and a prime, this returns the residue by applying given function
     * this must be thread safe and communicable
     * \param p Prime Integer
     * \param f function used to compute residue
     * \return the residue
     */
    template<class Function, class Domain >
    struct Residue {

        Function *_f;
        Residue(): _f(0) {}
        Residue(Function& ff): _f(&ff) {}
        Residue(const Residue<Function,Domain>&r ) : _f(r._f) {}
    
        typename Domain::Element operator()(Domain D) {
            typename Domain::Element d;
            D.init(d);
            return (*_f)(d,D);
        }
    };

    template<class CRABase>
    struct ChineseRemainder {

        typedef typename CRABase::Domain	Domain;
        typedef typename CRABase::DomainElement	DomainElement;
    protected:
        CRABase Builder_;
        
    public:
        template<class Param>
        ChineseRemainder(const Param& b) : Builder_(b) {}


        template<class Int, class Function, class PrimeIterator>
        Int& operator() (Int& res, Function& Iteration, PrimeIterator& primeiter) {

            double start = Util::WallTimer::gettime();

            ++primeiter; 
            Domain D(*primeiter); 
            DomainElement r; D.init(r);
            Builder_.initialize( D, Iteration(r, D) );

            // the task used to extract residue
            Residue<Function,Domain> residue(Iteration);

            size_t nb_primes = 4;
            size_t nb_done=0;

            while( ! Builder_.terminated() )
            {
                Domain domains [nb_primes];
                DomainElement domainelements[nb_primes];

                // generate the array of domain
                for (size_t i=0;i < nb_primes;i++) {
                    do {
                        ++primeiter;
                    } while( Builder_.noncoprime(*primeiter) ) ;
                    domains[i]=Domain(*primeiter);
                }

                // recursively call the send function
                a1::transform(
                    domains,
                    domains+nb_primes,
                    domainelements,
                    residue
                );

                // when it's done, analyze the result
                for(size_t i=0;i<nb_primes;++i) {
                    Builder_.progress(domains[i], domainelements[i]);
                }

                nb_done+=nb_primes;
                nb_primes=nb_done/2;
            }

            std::cout << "TIME=" << Util::WallTimer::gettime()-start << std::endl;
            return Builder_.result(res);
        }

        template<class Int, template <class T> class Vect, class Function, class PrimeIterator>
        Vect<Int> & operator() (Vect<Int>& res, Function& Iteration, PrimeIterator& primeiter) {
            
            ++primeiter; 
            Domain D(*primeiter); 
            Vect<DomainElement> r; 
            Builder_.initialize( D, Iteration(r, D) );

            while( ! Builder_.terminated() ) {
                ++primeiter; while(Builder_.noncoprime(*primeiter) ) ++primeiter; 
                Domain D(*primeiter); 
                Vect<DomainElement> r; 
                Builder_.progress( D, Iteration(r, D) );
            }
            return Builder_.result(res);
        }

    };

}

/*
 * marshalling operator, 
 * WARNING: those are dummy ones, the real ones are *really* hard to implement because of BlackBoxes
 * whose interface is hidden and does not make it easy to be communicable
 */

template<class Function, class Domain > 
a1::OStream& operator<<( a1::OStream& out, const LinBox::Residue<Function, Domain>&  ) {
	return out ;
}

template<class Function, class Domain > 
a1::IStream& operator>>( a1::IStream& in,  LinBox::Residue<Function, Domain>&  )
{
    return in;
}
#endif