732{
734 {
737 if(
G.inCoeffDomain())
741 }
743 {
747 return F*lcinv;
748 }
751
754 int *bound, *other;
755 bool fail;
756 bool off_rational=!
isOn(SW_RATIONAL);
769 {
771 {
774 }
775 }
776 else
777 {
779 {
784 if (off_rational)
Off(SW_RATIONAL);
785 return tmp;
786 }
787 }
788
792
794
795 int mv =
f.level();
i =
g.level();
798
799 bound = new int[mv+1];
800 other = new int[mv+1];
801 for(
int i=1;
i<=mv;
i++)
802 bound[
i] = other[
i] = 0;
805 for(
int i=1;
i<=mv;
i++)
806 if(other[
i] < bound[
i])
808
810 q = 1;
815 {
818 continue;
819 fail = false;
823
828 {
830 continue;
831 }
833 {
836 if(fail)
837 continue;
839 if (off_rational)
Off(SW_RATIONAL);
else On(SW_RATIONAL);
840 delete[] other;
841 delete[] bound;
843 }
845
846 for(
int i=1;
i<=mv;
i++)
849
850 if(
isEqual(bound, other, 1, mv))
851 {
853
854
855
856 q = newq;
864 "time for rational reconstruction in alg gcd: ")
872#ifdef HAVE_NTL
873#ifdef HAVE_FLINT
874 if (
equal && tmp.isUnivariate() &&
f.isUnivariate() &&
g.isUnivariate()
875 &&
f.level() == tmp.level() && tmp.level() ==
g.level())
876 {
877 CanonicalForm Q, R;
878 newtonDivrem (f, tmp, Q, R);
879 if (R.isZero())
880 {
881 newtonDivrem (g, tmp, Q, R);
882 if (R.isZero())
883 {
884 Off (SW_RATIONAL);
885 setReduce (a,true);
886 if (off_rational) Off(SW_RATIONAL); else On(SW_RATIONAL);
887 TIMING_END_AND_PRINT (alg_termination,
888 "time for successful termination test in alg gcd: ")
889 delete[] other;
890 delete[] bound;
891 return tmp*gcdcfcg;
892 }
893 }
894 }
895 else
896#endif
897#endif
899 {
902 if (off_rational)
Off(SW_RATIONAL);
else On(SW_RATIONAL);
904 "time for successful termination test in alg gcd: ")
905 delete[] other;
906 delete[] bound;
908 }
910 "time for unsuccessful termination test in alg gcd: ")
913 continue;
914 }
916 continue;
917
922 }
923
925 delete[] other;
926 delete[] bound;
930 if (off_rational)
Off(SW_RATIONAL);
else On(SW_RATIONAL);
932}
for(int i=0;i<=n;i++) degsf[i]
bool isLess(int *a, int *b, int lower, int upper)
static void leadDeg(const CanonicalForm &f, int degs[])
bool isEqual(int *a, int *b, int lower, int upper)
void tryInvert(const CanonicalForm &F, const CanonicalForm &M, CanonicalForm &inv, bool &fail)
CanonicalForm bCommonDen(const CanonicalForm &f)
void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r,...
CanonicalForm Farey(const CanonicalForm &f, const CanonicalForm &q)
Farey rational reconstruction.
bool fdivides(const CanonicalForm &f, const CanonicalForm &g)
void FACTORY_PUBLIC chineseRemainder(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew)
void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2,...
static const int SW_USE_QGCD
set to 1 to use Encarnacion GCD over Q(a)
int cf_getBigPrime(int i)
CanonicalForm alg_content(const CanonicalForm &f, const CFList &as)
bool isZero(const CFArray &A)
checks if entries of A are zero
void setReduce(const Variable &alpha, bool reduce)
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
if(!FE_OPT_NO_SHELL_FLAG)
#define TIMING_END_AND_PRINT(t, msg)