/usr/include/givaro/givpoly1crtconvert.inl 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 | // ==========================================================================
// Copyright(c)'1994-2009 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.
// Authors: J-G Dumas
// Time-stamp: <20 May 10 15:52:06 Jean-Guillaume.Dumas@imag.fr>
// Description: Polynomial Chinese Remaindering of degree 1
// ==========================================================================
#ifndef __GIVARO_poly1_crt_convert_INL
#define __GIVARO_poly1_crt_convert_INL
namespace Givaro {
// Converts a Polynomial to a RNS representation (which is given by this)
template<class Field>
typename Poly1CRT<Field>::array_T& Poly1CRT<Field>::RingToRns( typename Poly1CRT<Field>::array_T& rns , const typename Poly1CRT<Field>::Element& a) const {
size_t Size = _primes.size();
if (rns.size() != Size) rns.resize(Size);
for (size_t i=0; i<Size; i++)
_PolRing.eval(rns[i], a, _primes[i]);
return rns;
}
} // Givaro
#ifdef GIVARO_CRT_EARLY_TERMINATION
#ifndef GIVARO_CRT_EARLY_TERMINATION_THRESHOLD
#define GIVARO_CRT_EARLY_TERMINATION_THRESHOLD 4
#endif
#endif
namespace Givaro {
// Converts an array of field residues to a Polynomial
template<class Field>
typename Poly1CRT<Field>::Element& Poly1CRT<Field>::RnsToRing(typename Poly1CRT<Field>::Element& I, const typename Poly1CRT<Field>::array_T& rns) {
this->ComputeCk();
size_t Size = _primes.size();
_PolRing.assign(I, Degree(0), rns[0]);
#ifdef GIVARO_CRT_EARLY_TERMINATION
size_t EarlyTerm = 0;
#endif
// _PolRing.write(std::cerr<< "R[0]: ", I) <<std::endl;
for(size_t i=1; i<Size; ++i) {
Type_t addon;
_PolRing.eval(addon, I, _primes[i]);
// _F.write(_PolRing.write(_F.write(std::cout << "subs(X=", _primes[i]) << ",", I) << ") mod " << _F.characteristic() << " = ", addon) << ';' << std::endl;
_F.negin(addon);
_F.addin(addon, rns[i]);
#ifdef GIVARO_CRT_EARLY_TERMINATION
if (_F.isZero(addon))
++EarlyTerm;
else {
EarlyTerm=0;
#endif // GIVARO_CRT_EARLY_TERMINATION
_PolRing.axpyin(I, addon, _ck[i]);
// _PolRing.modin(I, _ck[i+1]);
#ifdef GIVARO_CRT_EARLY_TERMINATION
}
if (EarlyTerm >= EarlyTermThreshold)
break;
#endif // GIVARO_CRT_EARLY_TERMINATION
}
// loc.stop(); std::cerr << "RnsToRing. CRT: " << loc << std::endl;
return I;
}
} // Givaro
#endif // __GIVARO_poly1_crt_convert_INL
|