This file is indexed.

/usr/include/givaro/givextension.h is in libgivaro-dev 3.2.13-1.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
 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
#include <gmp.h>
#include <givaro/givgfq.h>
#include <givaro/givpoly1.h>
#include <givaro/givpoly1factor.h>
#include "givaro/givtablelimits.h"


template<class Rt> Rt FF_EXPONENT_MAX(const Rt p, const Rt e = 1) {
    Rt f = 0;
    for(Rt i = p; (i < (Rt)FF_TABLE_MAX) && (f < e); ++f, i*=p) 
        ;
    for( ; f > 1; --f)
        if ((e % f) == 0) break;
    return f;
}

#define NEED_POLYNOMIAL_REPRESENTATION(p,e) ((e) > FF_EXPONENT_MAX((p),(e)))

#define EXTENSION(q,expo) ( NEED_POLYNOMIAL_REPRESENTATION((q),(expo)) ? Extension<>((q), (expo)) : GFqDom<long>((q), (expo)) )

template<class BFT = GFqDom<long>  >
class Extension {
public:
    typedef Extension<BFT> Self_t;
    typedef BFT BaseField_t;
    typedef typename BFT::Element BFElement; 
    typedef typename Signed_Trait<BFElement>::unsigned_type Residu_t;

    typedef Poly1FactorDom< BFT, Dense > Pol_t;
    typedef typename Pol_t::Element PolElement;

protected:

    BaseField_t _bF;
    Pol_t _pD;
    PolElement _irred;
     Residu_t _characteristic; 
     Residu_t _exponent;
     Residu_t _extension_order;
     Integer _cardinality;

public:

    bool extension_type () const { return true; }

    typedef PolElement Element;


    Extension ( const Residu_t p, const Residu_t e = 1)
: _bF(p, FF_EXPONENT_MAX(p,e) ), _pD( _bF, Indeter("ý")  ), _characteristic( p ), _exponent ( e ) , _extension_order( e/FF_EXPONENT_MAX(p,e) ) , _cardinality( pow(Integer(p),(unsigned long)(e)) ) {
/*     cerr << "Pol Cstor" << endl; */
        unsigned long basedegree = FF_EXPONENT_MAX(p,e) ;
        if (basedegree >= e) 
            cerr << "ERROR : Try a direct extension field GFDom instead of a polynomial extension" << endl;
        else
            _pD.creux_random_irreducible( _irred, _extension_order );
    }

    Extension ( const BaseField_t& bF, const Residu_t ex = 1)
: _bF( bF ), _pD( _bF, Indeter("ý")  ), _characteristic( bF.characteristic() ), _exponent( ex + bF.exponent() ), _extension_order( ex ), _cardinality( pow( Integer(bF.cardinality()), (unsigned long)(ex) ) ) {
        if (_cardinality < (1<<20) )
            _pD.creux_random_irreducible( _irred, (unsigned long)(ex));
        else
            _pD.random_irreducible( _irred, (unsigned long)(ex));
    }

    Extension ( const Self_t& eF)
            : _bF( eF._bF ), _pD( eF._pD ), _irred( eF._irred ), _characteristic( eF._characteristic ), _exponent( eF._exponent ) , _extension_order( eF._extension_order ), _cardinality( eF._cardinality ) { }

    Self_t & operator=(const Self_t& eF) {
        if (this != &eF) {
            _bF = eF._bF;
            _pD = eF._pD;
            _irred = eF._irred;
            _characteristic = eF._characteristic;
            _exponent = eF._exponent;
            _extension_order = eF._extension_order;
            _cardinality = eF._cardinality;
        }
        return *this;
    }
    
    PolElement& init( PolElement& e) const { 
        return _pD.init(e) ; 
    }
    
    template<class XXX>
    PolElement& init( PolElement& e, const XXX& i) const { 
        return _pD.modin( _pD.init(e, i), _irred) ; 
    }
    
    PolElement& assign( PolElement& e, const BFElement& a) const { 
        return _pD.assign(e, a) ; 
    }

    PolElement& assign( PolElement& e, const PolElement& a) const { 
        return _pD.assign(e, a) ; 
    }

    template<class XXX>
    XXX& convert( XXX& i, const PolElement& e) const { 
        return _pD.convert( i, e) ; 
    }

    PolElement& add (PolElement& r, const PolElement& a, const PolElement& b) const {
        return _pD.add( r, a, b);
    }
  
    PolElement& sub (PolElement& r, const PolElement& a, const PolElement& b) const {
        return _pD.sub( r, a, b);
    }
  
    PolElement& neg (PolElement& r, const PolElement& a) const {
        return _pD.neg( r, a );
    }
  
    PolElement& mul (PolElement& r, const PolElement& a, const PolElement& b) const {
        return _pD.modin( _pD.mul( r, a, b), _irred );
    }
  
    PolElement& inv (PolElement& r, const PolElement& a) const {
//          _pD.write(_pD.write(_pD.write( std::cerr << "(", _pD.invmod( r, a, _irred)) << ") * (", a) << ")   == 1 + V * (", _irred) << std::endl;
         return  _pD.invmod( r, a, _irred);
     }
  
    PolElement& div (PolElement& r, const PolElement& a, const PolElement& b) const {
        return _pD.modin( _pD.mulin( inv(r, b), a), _irred );
    }
    
    PolElement& axpy (PolElement& r, const PolElement& a, const PolElement& b, const PolElement& c) const {
        return _pD.modin( _pD.addin(_pD.mul( r, a, b), c), _irred );
    }
  
    PolElement& addin(PolElement& r, const PolElement& b) const {
        return _pD.addin( r, b);
    }
  
    PolElement& subin(PolElement& r, const PolElement& b) const {
        return _pD.subin( r, b);
    }
  
    PolElement& negin(PolElement& r) const {
        return _pD.negin( r );
    }
  
    PolElement& mulin(PolElement& r, const PolElement& b) const {
        return _pD.modin( _pD.mulin( r, b), _irred );
    }
  
    PolElement& invin(PolElement& r) const {
         PolElement a(r);
         return _pD.invmod( r, a, _irred);
     }
  
    PolElement& divin(PolElement& r, const PolElement& b) const {
        PolElement tmp;
        inv(tmp,b);
        return _pD.modin( _pD.mulin( r, tmp), _irred );
    }
    
    PolElement& axpyin(PolElement& r, const PolElement& b, const PolElement& c) const {
        PolElement tmp; _pD.mul(tmp,b,c);
        return _pD.modin( _pD.addin( r, tmp), _irred );
    }
  
    bool areEqual (const PolElement& b, const PolElement& c) const {
        return _pD.areEqual( b, c) ;
    }
            
    bool isZero (const PolElement& b) const {
        return _pD.isZero(b) ;
    }
            
    bool isOne (const PolElement& b) const {
        return _pD.isOne(b) ;
    }
            
    
    Integer &cardinality (Integer &c) const 
        { return c=_cardinality; }

    Integer &characteristic (Integer &c) const
        { return c=_characteristic; }

    Residu_t characteristic() const {
        return _characteristic;
    }

    Residu_t exponent() const {
        return _exponent;
    }

    Residu_t order() const {
        return _extension_order;
    }


    const BaseField_t& base_field() const {
        return _bF;
    }
    
            
    const Pol_t&  polynomial_domain() const {
        return _pD;
    }
    
            

    std::ostream&  write( std::ostream& o ) const {
        return _pD.write( _pD.write(o) << "/(", _irred) << ")";
    }
    

    std::istream& read ( std::istream& s, PolElement& a ) const { 
        _pD.read( s, a); 
        _pD.modin( a, _irred); 
        return s; 
    }

    std::ostream& write( std::ostream& o, const PolElement& R) const {
        return _pD.write( o, R );
    }


    std::istream&  read( std::istream& o ) const {
	std::cerr << "READ Extension, NOT YET IMPLEMENTED" << std::endl;
        return o;
    }
    
};


template <class ExtensionField, class Type> 
class GIV_ExtensionrandIter
{ 

  public:
    
    /** @name Common Object Interface.
     * These methods are required of all LinBox random field Element generators.
     */
    //@{
   
    /** Field Element type.
     * The field Element must contain a default constructor, 
     * a copy constructor, a destructor, and an assignment operator.
     */
    typedef typename ExtensionField::PolElement Element;    

    /** Constructor from field, sampling size, and seed.
     * The random field Element iterator works in the field F, is seeded
     * by seed, and it returns any one Element with probability no more
     * than 1/min(size, F.cardinality()).
     * A sampling size of zero means to sample from the entire field.
     * A seed of zero means to use some arbitrary seed for the generator.
     * This implementation sets the sampling size to be no more than the
     * cardinality of the field.
     * @param F LinBox field archetype object in which to do arithmetic
     * @param size constant integer reference of sample size from which to 
     *             sample (default = 0)
     * @param seed constant integer reference from which to seed random number
     *             generator (default = 0)
     */
    GIV_ExtensionrandIter(const  ExtensionField& F,
		 const Type& size = 0, 
		 const Type& seed = 0)
            : _size(size), _givrand( GivRandom(seed) ), _field(F)
      {	
          Type charact    = Type( F.characteristic() );
          if ((_size > charact) || (_size == 0) )
              _size = charact; 
      }

    /** Copy constructor.
     * Constructs ALP_randIter object by copying the random field
     * Element generator.
     * This is required to allow generator objects to be passed by value
     * into functions.
     * In this implementation, this means copying the random field Element
     * generator to which R._randIter_ptr points.
     * @param  R ALP_randIter object.
     */
    GIV_ExtensionrandIter(const GIV_ExtensionrandIter& R)
      : _size(R._size), _givrand(R._givrand) , _field(R._field) {}

    /** Destructor.
     * This destructs the random field Element generator object.
     * In this implementation, this destroys the generator by deleting 
     * the random generator object to which _randIter_ptr points.
     */
    ~GIV_ExtensionrandIter(void) {}
    
    /** Assignment operator.
     * Assigns ALP_randIter object R to generator.
     * In this implementation, this means copying the generator to
     * which R._randIter_ptr points.
     * @param  R ALP_randIter object.
     */
    GIV_ExtensionrandIter<ExtensionField,Type>& operator=(const GIV_ExtensionrandIter<ExtensionField,Type>& R)
    {
      if (this != &R) // guard against self-assignment
      {
	_size = R._size;
	_givrand = R._givrand;
	_field = R._field;
      }

      return *this;
    }
 
    /** Random field Element creator with assignement.
     * This returns a random field Element from the information supplied
     * at the creation of the generator.
     * @return random field Element
     */	
    Element& random(Element& elt) const
      {
      // Create new random Elements     
          elt.resize( (size_t)(_field.order()));
          for(typename Element::iterator it = elt.begin(); it != elt.end() ; ++ it) {
	    long tmp = static_cast<long>((double (_givrand()) / double(_GIVRAN_MODULO_)) * double(_size));
            (_field.base_field()).init(*it , tmp);
	    //(_field.base_field()) . random (*it);
          }
          return elt;
      } // Element& random(Element& )
      
    /** Random field Element creator with assignement.
     * This returns a random field Element from the information supplied
     * at the creation of the generator.
     * @return random field Element
     */	
    Element& operator()(Element& elt) const 
        {
            return this->random(elt);
        }

    /** Random field Element creator.
     * This returns a random field Element from the information supplied
     * at the creation of the generator.
     * @return random field Element
     */
    Element& operator() (void)
    {
      Element* x=new Element;
      return this->random(*x);

    } // Element& operator() (void)
	
    

    //@} Common Object Iterface
   
    /** @name Implementation-Specific Methods.
     * These methods are not required of all 
     * \Ref{LinBox Random field Element generators}
     * and are included only for this implementation of the archetype.
     */
    //@{

    /// Default constructor
    GIV_ExtensionrandIter(void) : _size(0) {GivRandom tmp();_givrand=tmp;ExtensionField f(); _field=f;}
    
    //@}

 private:

   /// Sampling size
      Type _size;

   /// Random generator
      GivRandom _givrand;

   /// ExtensionField 	
      ExtensionField _field;  

  }; //  class GIV_ExtensionrandIter