732{
734 {
741 }
743 {
747 return F*lcinv;
748 }
751
755 bool fail;
769 {
771 {
774 }
775 }
776 else
777 {
779 {
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++)
805 for(
int i=1;
i<=mv;
i++)
808
810 q = 1;
815 {
818 continue;
819 fail = false;
823
828 {
830 continue;
831 }
833 {
836 if(fail)
837 continue;
840 delete[] other;
843 }
845
846 for(
int i=1;
i<=mv;
i++)
849
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 {
904 "time for successful termination test in alg gcd: ")
905 delete[] other;
908 }
910 "time
for unsuccessful termination
test in alg
gcd: ")
913 continue;
914 }
916 continue;
917
922 }
923
925 delete[] other;
932}
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)
CanonicalForm bCommonDen ( const CanonicalForm & f )
bool fdivides(const CanonicalForm &f, const CanonicalForm &g)
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)
static const int SW_RATIONAL
set to 1 for computations over Q
static CanonicalForm bound(const CFMatrix &M)
int cf_getBigPrime(int i)
CanonicalForm alg_content(const CanonicalForm &f, const CFList &as)
for(j=0;j< factors.length();j++)
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)
static number Farey(number, number, const coeffs)
#define TIMING_END_AND_PRINT(t, msg)