This file is indexed.

/usr/include/givaro/gfqkronecker.h is in libgivaro-dev 4.0.2-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
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
// ==========================================================================
// Copyright(c)'1994-2010 by The Givaro group
// This file is part of Givaro.
// Givaro is governed by the CeCILL-B license under French law
// and abiding by the rules of distribution of free software.
// see the COPYRIGHT file for more details.
// file: gfqkronecker.h
// Time-stamp: <12 Apr 10 16:45:02 Jean-Guillaume.Dumas@imag.fr>
// date: 2007
// version:
// author: Jean-Guillaume.Dumas

/*! @file gfqkronecker.h
 * @ingroup zpz
 * @brief  Arithmetic on GF(p^k), with dynamic Kronecker substitution.
 * @pre  k(p-1)^2 < word size
 */

#ifndef __GIVARO_gfq_kronecker_H
#define __GIVARO_gfq_kronecker_H

#include "givaro/givzpz.h"
#include "givaro/givzpzInt.h"
#include "givaro/gfq.h"
#include "givaro/givpower.h"
#include <limits>
#include <vector>
#include <deque>

namespace Givaro {

	//! GFqKronecker
template<class TT, class Ints> struct GFqKronecker : public GFqDom<TT> {
protected:
    typedef typename Signed_Trait<TT>::unsigned_type UTT;
    typedef TT Rep;
    typedef GFqDom<TT> Father_t;

public:
    typedef GFqKronecker<TT,Ints> Self_t;

    typedef Rep Element;
    typedef Element* Element_ptr ;
  typedef const Element* ConstElement_ptr;


    typedef UTT Residu_t;

    typedef Rep* Array;
    typedef const Rep* constArray;

    typedef ModularRandIter< Father_t , Rep> RandIter;

    GFqKronecker(): Father_t() {}

        // Extension MUST be a parameter of the constructor
    GFqKronecker( const UTT P, const UTT e) : Father_t(P,e), _degree(e-1),_epmunsq(e*(P-1)*(P-1))  {
        buildsmalltables();
        setShift(std::numeric_limits<UTT>::digits/( (e<<1)-1) );
    }

    Ints getMaxn() const {
	return _sMAXN;
    }
    UTT getShift() const {
	return _SHIFTS;
    }
    UTT getBase() const {
	return _sBASE;
    }

        // Set shifts, returns maxn
    Ints setShift(const Ints& i) {
        _SHIFTS=i;
        _sBASE = Ints(1); _sBASE <<=_SHIFTS;
        _sMASK = _sBASE - 1;
        return _sMAXN = _sBASE / _epmunsq;
    }

        // Set maxn, returns shifts
    UTT setMaxn(const Ints& n) {
        _sMAXN = n;
        Ints m = _sMAXN * _epmunsq;
        _SHIFTS = 0;
        for(_sBASE = 1; _sBASE < m; ++_SHIFTS, _sBASE<<=1);
        _sMASK = _sBASE - 1;
        return _SHIFTS;
    }


    virtual ~GFqKronecker() {};

    using Father_t::init;
    using Father_t::convert;

    virtual Ints& convert(Ints& r, const Rep a) const {
            // First Step
            // 	from element to polynomial coefficient binary shifted
        UTT binpol=_log2bin[a];
            // Second step
            // 	from a0|a1|...|ad
            // 	to 0-0ad | ... | 0-0a1 | 0-0a0
        r = binpol & _pMASK; // a0
        for(size_t i=1; i<this->_exponent; ++i) {
            r <<= _SHIFTS;
            binpol >>= _pceil;
            r |= ( binpol & _pMASK);
        }
        return r;
    }



    virtual Rep& init(Rep& a, const Ints r) const {
            // WARNING: This could be speeded up with a REDQ transform

            // First Step lower part
            // 	from rd | ... | r1 | r0
            // 	to   a0|a1|...|ad
            // 	where ai = ri mod p
        Ints rs=r;
        UTT binpolLOW = (UTT)( (rs & _sMASK) % this->_characteristic);
        for(size_t i=1; i<this->_exponent; ++i) {
            binpolLOW <<= _pceil;
            rs >>= _SHIFTS;
            binpolLOW |= (UTT)( (rs & _sMASK) % this->_characteristic);
        }
            // First Step upper part
        rs >>= _SHIFTS;
        UTT binpolHIGH = (UTT)( (rs & _sMASK) % this->_characteristic);
        for(size_t i=1; i<this->_degree; ++i) {
            binpolHIGH <<= _pceil;
            rs >>= _SHIFTS;
            binpolHIGH |= (UTT)( (rs & _sMASK) % this->_characteristic);
        }
        binpolHIGH <<= _pceil;

            // Second step
            //  transform to element H*X^k+L
        return this->axpy(a, _bin2log[binpolHIGH], _Xk, _bin2log[binpolLOW]);
    }




protected:
    std::ostream& polywrite(std::ostream& out, const Element& a, const Indeter In= "B") const {
        static Modular<Integer> Zp(this->_characteristic);
        static Poly1PadicDom<Modular<Integer> > PAD(Zp ,In);
        static Poly1PadicDom<Modular<Integer> >::Element pol;
        Integer r;
        PAD.radixdirect(pol, this->convert(r, a), this->_exponent);
        return PAD.write(out, pol);
    }


    void buildsmalltables() {
        _log2bin.resize(this->_log2pol.size());
        _pceil = 1;
        for(unsigned long ppow = 2; ppow < this->_characteristic; ppow <<= 1,++_pceil) {}
        _pMASK = (1<<_pceil) - 1;

        Father_t Zp(this->_characteristic,1);
        typedef Poly1FactorDom< Father_t, Dense > PolDom;
        PolDom Pdom( Zp );
        typedef Poly1PadicDom< Father_t, Dense > PadicDom;
        PadicDom PAD(Pdom);

        typename std::vector<UTT>::iterator binit = _log2bin.begin();
        typename std::vector<UTT>::const_iterator polit = this->_log2pol.begin();
        for( ; polit != this->_log2pol.end(); ++polit, ++binit) {

            std::vector<unsigned long> vect;
            PAD.radixdirect( vect, (unsigned long)(*polit), this->_exponent);

            *binit = vect[0];
            for(size_t i =1; i<this->_exponent; ++i) {
                *binit <<= _pceil;
                *binit += vect[i];
            }
        }

        _bin2log.resize( 1<<(_pceil*this->_exponent) );
        for(size_t i=0; i<_log2bin.size(); ++i)
            _bin2log[ _log2bin[ i ] ] = i;


            // This is X
        _Xk = this->_pol2log[this->_characteristic];
//         polywrite(std::cerr << "Xk: " << _Xk << " rep ", _Xk) << std::endl;
            // This is X^{e}
        dom_power(_Xk,_Xk,this->_exponent,*this);
//         polywrite(std::cerr << "Xk: ", _Xk) << std::endl;
    }



    UTT _SHIFTS;
    Ints _sBASE,_sMASK,_sMAXN;

    UTT _pceil,_pMASK,_degree;
    Ints _epmunsq;

    std::vector<UTT> _log2bin;
    std::vector<UTT> _bin2log;

    Element _Xk;
};

} // namespace Givaro

#endif // __GIVARO_gfq_kronecker_H