/usr/include/givaro/givpoly1ratrecon.inl is in libgivaro-dev 3.7.2-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 | // ===============================================================
// 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.
// Author: J-G. Dumas
// Time-stamp: <01 Apr 11 17:18:03 Jean-Guillaume.Dumas@imag.fr>
// Description: generic rational fraction reconstruction
// ===============================================================
#ifndef __GIVARO_poly1_ratrecon_INL
#define __GIVARO_poly1_ratrecon_INL
namespace Givaro {
template <class Domain>
void Poly1Dom<Domain,Dense>::ratrecon(typename Poly1Dom<Domain,Dense>::Rep& N, typename Poly1Dom<Domain,Dense>::Rep& D, const typename Poly1Dom<Domain,Dense>::Rep& P, const typename Poly1Dom<Domain,Dense>::Rep& M, const Degree& dk) const {
Degree degU, degV;
this->degree(degU,P); this->degree(degV,M);
if ((degU < dk) || (degV == 0)) { this->assign(N,P); this->assign(D,one); return ; }
if ((degV < 0) || (degU == 0)) { this->assign(N,one); this->assign(D,one); return ; }
typename Poly1Dom<Domain,Dense>::Rep U;
this->assign(N, M);
this->assign(U, P);
Degree degN;
typename Poly1Dom<Domain,Dense>::Rep Q, D0;
this->assign(D0,this->zero);
this->assign(D,this->one);
// do {
// this->divmod(Q,N,V,U);
// this->assign(V,U);
// this->assign(U,N);
// this->maxpy(TMP2,Q,D,D0);
// this->assign(D0,D);
// this->assign(D,TMP2);
// this->degree(degN, N);
// if (degN <= dk) break;
// } while (degN>=0);
do {
this->divmodin(Q,N,U);
this->maxpyin(D0,Q,D);
this->degree(degN, N);
if ((degN <= dk) || (degN <0)) {
this->assign(D,D0);
break;
}
this->divmodin(Q,U,N);
this->maxpyin(D,Q,D0);
this->degree(degN, U);
if (degN <= dk) {
this->assign(N,U);
break;
}
} while (degN>=0);
// do {
// this->divmod(Q,N,V,U);
// this->maxpyin(D0,Q,D);
// this->degree(degN, N);
// if ((degN <= dk) || (degN <0)) {
// this->assign(D,D0);
// break;
// }
// this->assign(V,N);
// this->divmod(Q,N,U,V);
// this->maxpyin(D,Q,D0);
// this->degree(degN, N);
// if (degN <= dk) break;
// this->assign(U,N);
// } while (degN>=0);
}
template <class Domain>
bool Poly1Dom<Domain,Dense>::ratreconcheck(typename Poly1Dom<Domain,Dense>::Rep& N, typename Poly1Dom<Domain,Dense>::Rep& D, const typename Poly1Dom<Domain,Dense>::Rep& P, const typename Poly1Dom<Domain,Dense>::Rep& M, const Degree& dk) const {
Degree degU, degV;
this->degree(degU,P); this->degree(degV,M);
if ((degU < dk) || (degV == 0)) { this->assign(N,P); this->assign(D,one); return true; }
if ((degV < 0) || (degU == 0)) { this->assign(N,one); this->assign(D,one); return false; }
ratrecon(N,D,P,M,dk);
typename Poly1Dom<Domain,Dense>::Rep G;
Degree degG;
if ( degree(degG, gcd(G, N, D)) > 0)
return false;
Type_t r; leadcoef(r, D);
if (! _domain.isOne(r)) {
this->divin(D, r);
this->divin(N, r);
}
return true;
}
} // Givaro
#endif // __GIVARO_poly1_ratrecon_INL
|