36 #include <NTL/lzz_pEX.h>
52 #if defined (HAVE_NTL) || defined(HAVE_FLINT)
54 #if (!(HAVE_FLINT && __FLINT_RELEASE >= 20400))
71 if (
i.getItem().inCoeffDomain())
94 #if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
98 nmod_poly_t FLINTmipo;
108 fq_nmod_poly_t *
vec=
new fq_nmod_poly_t [factors.
length()];
114 if (
i.getItem().inCoeffDomain())
133 for (
int i= 0;
i < factors.
length();
i++,
k++)
158 CFList bufFactors= factors;
171 for (;
i.hasItem();
i++)
176 i.getItem()=
reduce (
i.getItem()*inv,
M);
178 #if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
179 bufFactors= productsFLINT (bufFactors,
M);
181 bufFactors= productsNTL (bufFactors,
M);
199 zz_pEX NTLbuf1, NTLbuf2, NTLbuf3, NTLS, NTLT;
202 tryNTLXGCD (NTLbuf3, NTLS, NTLT, NTLbuf1, NTLbuf2, fail);
216 for (;
i.hasItem();
i++)
220 tryNTLXGCD (NTLbuf3, NTLS, NTLT, NTLbuf3, NTLbuf1, fail);
227 tryExtgcd (buf3,
buf1,
M, buf3, S,
T, fail);
235 j.getItem()=
mod (
j.getItem(),
k.getItem());
256 if (
mod (
i.getItem(),
p) == 0)
308 i.getItem() /=
Lc (
i.getItem());
347 while (
i >= 0 &&
mod( leadingCoeffs,
p ) == 0)
353 ASSERT (
i >= 0,
"ran out of primes");
357 modMipo /=
lc (modMipo);
377 p, newResult, newQ );
392 if (
j.getItem() !=
k.getItem())
417 i.getItem() *=
Lc (
j.getItem())*denf;
424 i.getItem() *= denFirst;
464 m.getItem()=
j.getItem();
467 j.getItem()=
m.getItem();
479 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
488 recResult=
mapinto (recResult);
496 bufFactors[
k]=
i.getItem() (0);
498 bufFactors [
k]=
i.getItem();
504 for (
int l= 0;
l < factors.
length();
l++)
510 tmp=
mulNTL (tmp, bufFactors[
l]);
523 e=
b (e -
mulNTL (
i.getItem(),
j.getItem(),
b));
531 recResult=
mapinto (recResult);
537 for (
int i= 1;
i < d;
i++)
539 coeffE=
div (e, modulus);
550 for (;
j.hasItem();
j++,
k++,
l++, ii++)
553 g=
modNTL (coeffE, bufFactors[ii]);
557 k.getItem() +=
g.mapinto()*modulus;
558 e -=
mulNTL (
g.mapinto(), b2 (
l.getItem()), b2)*modulus;
583 bool mipoHasDen=
false;
597 modMipo /=
lc (modMipo);
609 if (bb.
getk() >
b.getk() )
b=bb;
616 recResult=
mapinto (recResult);
625 bufFactors[
k]=
i.getItem() (0);
627 bufFactors [
k]=
i.getItem();
634 for (
int l= 0;
l < factors.
length();
l++)
639 tmp=
mulNTL (tmp, bufFactors[
l]);
662 modMipo /=
lc (modMipo);
669 bufFactors [
k]= bufFactors[
k].mapinto();
676 for (;
j.hasItem();
j++)
682 j.getItem()=
b(
j.getItem()*
b.inverse(
lc(
j.getItem())));
690 e=
b (e -
mulNTL (
i.getItem(),
j.getItem(),
b));
711 recResult=
mapinto (recResult);
722 for (
int i= 1;
i < d;
i++)
724 coeffE=
div (e, modulus);
747 for (;
j.hasItem();
j++,
k++,
l++, ii++)
750 g=
modNTL (coeffE, bufFactors[ii]);
759 b2 (
l.getItem()), b2)*modulus;
767 b2 (
l.getItem()), b2)*modulus;
786 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
799 fq_poly_t FLINTS, FLINTT, FLINTbuf3, FLINTbuf1, FLINTbuf2;
806 bool mipoHasDen=
false;
820 modMipo /=
lc (modMipo);
833 if (bb.
getk() >
b.getk() )
b=bb;
858 CFList bufFactors= factors;
862 for (;
i.hasItem();
i++)
883 ZZ_pEX NTLS, NTLT, NTLbuf3;
886 XGCD (NTLbuf3, NTLS, NTLT, NTLbuf1, NTLbuf2);
893 fmpz_mod_poly_t FLINTmipo;
895 #if __FLINT_RELEASE >= 20700
896 fmpz_mod_ctx_t bigpk_ctx;
897 fmpz_mod_ctx_init(bigpk_ctx, bigpk);
898 fq_ctx_init_modulus(fqctx, FLINTmipo, bigpk_ctx,
"Z");
899 fmpz_mod_ctx_clear(bigpk_ctx);
900 fmpz_mod_poly_clear(FLINTmipo, bigpk_ctx);
902 fq_ctx_init_modulus(fqctx, FLINTmipo,
"Z");
903 fmpz_mod_poly_clear(FLINTmipo);
906 fq_init(fcheck, fqctx);
907 fq_poly_init(FLINTS, fqctx);
908 fq_poly_init(FLINTT, fqctx);
909 fq_poly_init(FLINTbuf3, fqctx);
915 fq_poly_xgcd_euclidean_f(fcheck, FLINTbuf3, FLINTS, FLINTT,
916 FLINTbuf1, FLINTbuf2, fqctx);
917 if (!fq_is_one(fcheck, fqctx))
920 fq_clear(fcheck, fqctx);
921 fq_poly_clear(FLINTS, fqctx);
922 fq_poly_clear(FLINTT, fqctx);
923 fq_poly_clear(FLINTbuf3, fqctx);
924 fq_poly_clear(FLINTbuf1, fqctx);
925 fq_poly_clear(FLINTbuf2, fqctx);
938 for (;
i.hasItem();
i++)
949 fq_poly_clear(FLINTbuf1, fqctx);
953 fq_poly_xgcd_euclidean_f(fcheck, FLINTbuf2, FLINTS, FLINTT,
954 FLINTbuf3, FLINTbuf1, fqctx);
955 fq_poly_swap(FLINTbuf3, FLINTbuf2, fqctx);
957 if (!fq_is_one(fcheck, fqctx))
960 fq_clear(fcheck, fqctx);
961 fq_poly_clear(FLINTS, fqctx);
962 fq_poly_clear(FLINTT, fqctx);
963 fq_poly_clear(FLINTbuf3, fqctx);
964 fq_poly_clear(FLINTbuf1, fqctx);
965 fq_poly_clear(FLINTbuf2, fqctx);
979 j.getItem()=
modNTL (
j.getItem(),
k.getItem(),
b);
992 fq_clear(fcheck, fqctx);
993 fq_poly_clear(FLINTS, fqctx);
994 fq_poly_clear(FLINTT, fqctx);
995 fq_poly_clear(FLINTbuf3, fqctx);
996 fq_poly_clear(FLINTbuf1, fqctx);
997 fq_poly_clear(FLINTbuf2, fqctx);
1005 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
1042 for (;
i.hasItem();
i++)
1049 j.getItem()=
mulNTL (
j.getItem(), S);
1050 j.getItem()=
modNTL (
j.getItem(),
k.getItem());
1058 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
1081 E= F[
j] - Pi [factors.
length() - 2] [
j];
1113 bufFactors[
k] += xToJ*
buf[
k];
1115 bufFactors[
k]=
b(bufFactors[
k]);
1119 int degBuf0=
degree (bufFactors[0],
x);
1120 int degBuf1=
degree (bufFactors[1],
x);
1121 if (degBuf0 > 0 && degBuf1 > 0)
1122 M (
j + 1, 1)=
mulNTL (bufFactors[0] [
j], bufFactors[1] [
j],
b);
1125 if (degBuf0 > 0 && degBuf1 > 0)
1126 uIZeroJ=
mulNTL ((bufFactors[0] [0] + bufFactors[0] [
j]),
1127 (bufFactors[1] [0] +
buf[1]),
b) -
M(1, 1) -
M(
j + 1, 1);
1128 else if (degBuf0 > 0)
1129 uIZeroJ=
mulNTL (bufFactors[0] [
j], bufFactors[1],
b);
1130 else if (degBuf1 > 0)
1135 uIZeroJ=
b (uIZeroJ);
1136 Pi [0] += xToJ*uIZeroJ;
1141 for (
k= 0;
k < factors.
length() - 1;
k++)
1144 one= bufFactors [0];
1145 two= bufFactors [1];
1146 if (degBuf0 > 0 && degBuf1 > 0)
1148 for (
k= 1;
k <= (
j+1)/2;
k++)
1155 tmp[0] +=
mulNTL ((bufFactors[0][
k]+one.
coeff()), (bufFactors[1][
k]+
1156 two.
coeff()),
b) -
M (
k + 1, 1) -
M (
j -
k + 2, 1);
1162 tmp[0] +=
mulNTL ((bufFactors[0][
k]+one.
coeff()), bufFactors[1][
k],
b)
1168 tmp[0] +=
mulNTL (bufFactors[0][
k], (bufFactors[1][
k]+two.
coeff()),
b)
1175 tmp[0] +=
M (
k + 1, 1);
1181 Pi [0] += tmp[0]*xToJ*F.
mvar();
1185 for (
int l= 1;
l < factors.
length() - 1;
l++)
1188 degBuf=
degree (bufFactors[
l + 1],
x);
1189 if (degPi > 0 && degBuf > 0)
1190 M (
j + 1,
l + 1)=
mulNTL (Pi [
l - 1] [
j], bufFactors[
l + 1] [
j],
b);
1193 if (degPi > 0 && degBuf > 0)
1194 Pi [
l] += xToJ*(
mulNTL (Pi [
l - 1] [0] + Pi [
l - 1] [
j],
1195 bufFactors[
l + 1] [0] +
buf[
l + 1],
b) -
M (
j + 1,
l +1) -
1198 Pi [
l] += xToJ*(
mulNTL (Pi [
l - 1] [
j], bufFactors[
l + 1],
b));
1199 else if (degBuf > 0)
1204 if (degPi > 0 && degBuf > 0)
1206 uIZeroJ=
mulNTL (uIZeroJ, bufFactors [
l + 1] [0],
b);
1210 uIZeroJ=
mulNTL (uIZeroJ, bufFactors [
l + 1],
b);
1211 else if (degBuf > 0)
1213 uIZeroJ=
mulNTL (uIZeroJ, bufFactors [
l + 1] [0],
b);
1216 Pi[
l] += xToJ*uIZeroJ;
1218 one= bufFactors [
l + 1];
1222 if (degBuf > 0 && degPi > 0)
1233 if (degBuf > 0 && degPi > 0)
1235 for (
k= 1;
k <= (
j+1)/2;
k++)
1261 tmp[
l] +=
M (
k + 1,
l + 1);
1266 Pi[
l] += tmp[
l]*xToJ*F.
mvar();
1270 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
1288 bool hasAlgVar2=
false;
1299 DEBOUTLN (cerr,
"diophant= " << diophant);
1306 for (;
j.hasItem();
j++,
i++)
1309 M (1,
i + 1)= Pi [
i];
1316 bufFactors[
i]=
mod (
k.getItem(), F.
mvar());
1318 bufFactors[
i]=
k.getItem();
1320 for (
i= 1;
i <
l;
i++)
1325 k.getItem()= bufFactors[
i];
1330 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
1351 bufFactors[
i]=
mod (
k.getItem(), xToStart);
1353 bufFactors[
i]=
k.getItem();
1355 for (
i= start;
i < end;
i++)
1360 k.getItem()= bufFactors [
i];
1365 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
1380 i.getItem()=
mod (
i.getItem(),
y);
1391 bufFactors [
k]=
i.getItem();
1401 for (
int l= 0;
l < factors.
length();
l++)
1416 e -=
i.getItem()*
j.getItem();
1424 for (
int i= 1;
i < d;
i++)
1436 for (;
j.hasItem();
j++,
k++,
l++, ii++)
1438 g= coeffE*
j.getItem();
1439 if (
degree (bufFactors[ii],
y) <= 0)
1440 g=
mod (
g, bufFactors[ii]);
1442 g=
mod (
g, bufFactors[ii][0]);
1445 DEBOUTLN (cerr,
"mod (e, power (y, i + 1))= " <<
1481 bufFactors [
k]=
i.getItem();
1493 for (
int l= 0;
l < factors.
length();
l++)
1507 e -=
mulMod (
i.getItem(),
j.getItem(),
M);
1515 for (
int i= 1;
i < d;
i++)
1528 for (;
j.hasItem();
j++,
k++,
l++, ii++)
1531 if (
degree (bufFactors[ii],
y) <= 0)
1535 divrem (
g, bufFactors[ii][0], dummy,
g,
M);
1550 DEBOUTLN (cerr,
"test in multiRecDiophantine= " <<
test);
1570 for (
int i= 0;
i < factors.
length();
i++)
1579 test2=
mod (test2, MOD);
1580 DEBOUTLN (cerr,
"test in henselStep= " << test2);
1587 for (
int i= 0;
i < factors.
length();
i++)
1592 test *= bufFactors[
i];
1597 DEBOUTLN (cerr,
"test in henselStep= " << test2);
1601 E= F[
j] - Pi [factors.
length() - 2] [
j];
1616 divrem (
E, bufFactors[
k] [0], dummy, rest1, MOD);
1621 divrem (
E, bufFactors[
k], dummy, rest1, MOD);
1631 bufFactors[
k] += xToJ*
buf[
k];
1634 int degBuf0=
degree (bufFactors[0],
x);
1635 int degBuf1=
degree (bufFactors[1],
x);
1636 if (degBuf0 > 0 && degBuf1 > 0)
1637 M (
j + 1, 1)=
mulMod (bufFactors[0] [
j], bufFactors[1] [
j], MOD);
1640 if (degBuf0 > 0 && degBuf1 > 0)
1641 uIZeroJ=
mulMod ((bufFactors[0] [0] + bufFactors[0] [
j]),
1642 (bufFactors[1] [0] +
buf[1]), MOD) -
M(1, 1) -
M(
j + 1, 1);
1643 else if (degBuf0 > 0)
1644 uIZeroJ=
mulMod (bufFactors[0] [
j], bufFactors[1], MOD);
1645 else if (degBuf1 > 0)
1646 uIZeroJ=
mulMod (bufFactors[0],
buf[1], MOD);
1649 Pi [0] += xToJ*uIZeroJ;
1652 for (
k= 0;
k < factors.
length() - 1;
k++)
1655 one= bufFactors [0];
1656 two= bufFactors [1];
1657 if (degBuf0 > 0 && degBuf1 > 0)
1659 for (
k= 1;
k <= (
j+1)/2;
k++)
1667 (bufFactors[1] [
k] + two.
coeff()), MOD) -
M (
k + 1, 1) -
1675 bufFactors[1] [
k], MOD) -
M (
k + 1, 1);
1680 tmp[0] +=
mulMod (bufFactors[0] [
k], (bufFactors[1] [
k] +
1681 two.
coeff()), MOD) -
M (
k + 1, 1);
1687 tmp[0] +=
M (
k + 1, 1);
1691 Pi [0] += tmp[0]*xToJ*F.
mvar();
1695 for (
int l= 1;
l < factors.
length() - 1;
l++)
1698 degBuf=
degree (bufFactors[
l + 1],
x);
1699 if (degPi > 0 && degBuf > 0)
1700 M (
j + 1,
l + 1)=
mulMod (Pi [
l - 1] [
j], bufFactors[
l + 1] [
j], MOD);
1703 if (degPi > 0 && degBuf > 0)
1704 Pi [
l] += xToJ*(
mulMod ((Pi [
l - 1] [0] + Pi [
l - 1] [
j]),
1705 (bufFactors[
l + 1] [0] +
buf[
l + 1]), MOD) -
M (
j + 1,
l +1)-
1708 Pi [
l] += xToJ*(
mulMod (Pi [
l - 1] [
j], bufFactors[
l + 1], MOD));
1709 else if (degBuf > 0)
1714 if (degPi > 0 && degBuf > 0)
1716 uIZeroJ=
mulMod (uIZeroJ, bufFactors [
l + 1] [0], MOD);
1717 uIZeroJ +=
mulMod (Pi [
l - 1] [0],
buf [
l + 1], MOD);
1720 uIZeroJ=
mulMod (uIZeroJ, bufFactors [
l + 1], MOD);
1721 else if (degBuf > 0)
1723 uIZeroJ=
mulMod (uIZeroJ, bufFactors [
l + 1] [0], MOD);
1726 Pi[
l] += xToJ*uIZeroJ;
1728 one= bufFactors [
l + 1];
1732 if (degBuf > 0 && degPi > 0)
1743 if (degBuf > 0 && degPi > 0)
1745 for (
k= 1;
k <= (
j+1)/2;
k++)
1753 (Pi[
l - 1] [
k] + two.
coeff()), MOD) -
M (
k + 1,
l + 1) -
1754 M (
j -
k + 2,
l + 1);
1761 Pi[
l - 1] [
k], MOD) -
M (
k + 1,
l + 1);
1766 tmp[
l] +=
mulMod (bufFactors[
l + 1] [
k],
1767 (Pi[
l - 1] [
k] + two.
coeff()), MOD) -
M (
k + 1,
l + 1);
1772 tmp[
l] +=
M (
k + 1,
l + 1);
1775 Pi[
l] += tmp[
l]*xToJ*F.
mvar();
1781 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
1788 int liftBoundBivar=
l[
k];
1797 buf.insert (
LC (
j.getItem(), 1));
1799 bufFactors[
k]=
i.getItem();
1809 for (;
i.hasItem();
i++,
k++)
1811 Pi [
k]=
mulMod (Pi [
k - 1],
i.getItem(), MOD);
1812 M (1,
k + 1)= Pi [
k];
1815 for (
int d= 1; d <
l[1]; d++)
1835 bufFactors[
i]=
mod (
k.getItem(), xToStart);
1837 bufFactors[
i]=
k.getItem();
1839 for (
i= start;
i < end;
i++)
1840 henselStep (F, factors, bufFactors, diophant,
M, Pi,
i, MOD);
1844 k.getItem()= bufFactors [
i];
1861 bufFactors[
k]=
i.getItem();
1871 Pi [0]=
mod (Pi[0], xToLOld);
1876 for (;
i.hasItem();
i++,
k++)
1878 Pi [
k]=
mod (Pi [
k], xToLOld);
1879 M (1,
k + 1)= Pi [
k];
1882 for (
int d= 1; d < lNew; d++)
1890 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
1906 for (
int i= 0;
i < 2;
i++)
1914 for (
int i= 2;
i < lLength &&
j.hasItem();
i++,
j++)
1940 E= F[
j] - Pi [factors.
length() - 2] [
j];
1963 bufFactors[
k] += xToJ*
buf[
k];
1966 int degBuf0=
degree (bufFactors[0],
x);
1967 int degBuf1=
degree (bufFactors[1],
x);
1968 if (degBuf0 > 0 && degBuf1 > 0)
1970 M (
j + 1, 1)=
mulNTL (bufFactors[0] [
j], bufFactors[1] [
j]);
1971 if (
j + 2 <=
M.rows())
1972 M (
j + 2, 1)=
mulNTL (bufFactors[0] [
j + 1], bufFactors[1] [
j + 1]);
1978 if (degBuf0 > 0 && degBuf1 > 0)
1979 uIZeroJ=
mulNTL(bufFactors[0][0],
buf[1]) +
1981 else if (degBuf0 > 0)
1982 uIZeroJ=
mulNTL (
buf[0], bufFactors[1]) +
1984 else if (degBuf1 > 0)
1985 uIZeroJ=
mulNTL (bufFactors[0],
buf[1]) +
1988 uIZeroJ=
mulNTL (bufFactors[0],
buf[1]) +
1991 Pi [0] += xToJ*uIZeroJ;
1994 for (
k= 0;
k < factors.
length() - 1;
k++)
1997 one= bufFactors [0];
1998 two= bufFactors [1];
1999 if (degBuf0 > 0 && degBuf1 > 0)
2003 for (
k= 1;
k <= (
j+1)/2;
k++)
2010 tmp[0] +=
mulNTL ((bufFactors[0][
k]+one.
coeff()),(bufFactors[1][
k] +
2011 two.
coeff())) -
M (
k + 1, 1) -
M (
j -
k + 2, 1);
2017 tmp[0] +=
mulNTL ((bufFactors[0][
k]+one.
coeff()), bufFactors[1] [
k]) -
2023 tmp[0] +=
mulNTL (bufFactors[0][
k],(bufFactors[1][
k] + two.
coeff())) -
2029 tmp[0] +=
M (
k + 1, 1);
2033 if (degBuf0 >=
j + 1 && degBuf1 >=
j + 1)
2035 if (
j + 2 <=
M.rows())
2036 tmp [0] +=
mulNTL ((bufFactors [0] [
j + 1]+ bufFactors [0] [0]),
2037 (bufFactors [1] [
j + 1] + bufFactors [1] [0]))
2038 -
M(1,1) -
M (
j + 2,1);
2040 else if (degBuf0 >=
j + 1)
2043 tmp[0] +=
mulNTL (bufFactors [0] [
j+1], bufFactors [1] [0]);
2045 tmp[0] +=
mulNTL (bufFactors [0] [
j+1], bufFactors [1]);
2047 else if (degBuf1 >=
j + 1)
2050 tmp[0] +=
mulNTL (bufFactors [0] [0], bufFactors [1] [
j + 1]);
2052 tmp[0] +=
mulNTL (bufFactors [0], bufFactors [1] [
j + 1]);
2055 Pi [0] += tmp[0]*xToJ*F.
mvar();
2058 for (
int l= 1;
l < factors.
length() - 1;
l++)
2061 degBuf=
degree (bufFactors[
l + 1],
x);
2062 if (degPi > 0 && degBuf > 0)
2064 M (
j + 1,
l + 1)=
mulNTL (Pi [
l - 1] [
j], bufFactors[
l + 1] [
j]);
2065 if (
j + 2 <=
M.rows())
2066 M (
j + 2,
l + 1)=
mulNTL (Pi [
l - 1][
j + 1], bufFactors[
l + 1] [
j + 1]);
2069 M (
j + 1,
l + 1)= 0;
2071 if (degPi > 0 && degBuf > 0)
2073 mulNTL (uIZeroJ, bufFactors[
l+1] [0]);
2075 uIZeroJ=
mulNTL (uIZeroJ, bufFactors[
l + 1]) +
2077 else if (degBuf > 0)
2078 uIZeroJ=
mulNTL (uIZeroJ, bufFactors[
l + 1][0]) +
2081 uIZeroJ=
mulNTL (uIZeroJ, bufFactors[
l + 1]) +
2084 Pi [
l] += xToJ*uIZeroJ;
2086 one= bufFactors [
l + 1];
2088 if (degBuf > 0 && degPi > 0)
2092 for (
k= 1;
k <= (
j+1)/2;
k++)
2100 (Pi[
l - 1] [
k] + two.
coeff())) -
M (
k + 1,
l + 1) -
2101 M (
j -
k + 2,
l + 1);
2108 Pi[
l - 1] [
k]) -
M (
k + 1,
l + 1);
2113 tmp[
l] +=
mulNTL (bufFactors[
l + 1] [
k],
2114 (Pi[
l - 1] [
k] + two.
coeff())) -
M (
k + 1,
l + 1);
2119 tmp[
l] +=
M (
k + 1,
l + 1);
2123 if (degPi >=
j + 1 && degBuf >=
j + 1)
2125 if (
j + 2 <=
M.rows())
2126 tmp [
l] +=
mulNTL ((Pi [
l - 1] [
j + 1]+ Pi [
l - 1] [0]),
2127 (bufFactors [
l + 1] [
j + 1] + bufFactors [
l + 1] [0])
2128 ) -
M(1,
l+1) -
M (
j + 2,
l+1);
2130 else if (degPi >=
j + 1)
2133 tmp[
l] +=
mulNTL (Pi [
l - 1] [
j+1], bufFactors [
l + 1] [0]);
2135 tmp[
l] +=
mulNTL (Pi [
l - 1] [
j+1], bufFactors [
l + 1]);
2137 else if (degBuf >=
j + 1)
2140 tmp[
l] +=
mulNTL (Pi [
l - 1] [0], bufFactors [
l + 1] [
j + 1]);
2142 tmp[
l] +=
mulNTL (Pi [
l - 1], bufFactors [
l + 1] [
j + 1]);
2145 Pi[
l] += tmp[
l]*xToJ*F.
mvar();
2150 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
2159 CFList bufFactors2= factors;
2162 DEBOUTLN (cerr,
"diophant= " << diophant);
2170 if (
degree (bufFactors[0],
x) > 0 &&
degree (bufFactors [1],
x) > 0)
2172 M (1, 1)=
mulNTL (bufFactors [0] [0], bufFactors[1] [0]);
2173 Pi [0]=
M (1, 1) + (
mulNTL (bufFactors [0] [1], bufFactors[1] [0]) +
2174 mulNTL (bufFactors [0] [0], bufFactors [1] [1]))*
x;
2176 else if (
degree (bufFactors[0],
x) > 0)
2178 M (1, 1)=
mulNTL (bufFactors [0] [0], bufFactors[1]);
2180 mulNTL (bufFactors [0] [1], bufFactors[1])*
x;
2182 else if (
degree (bufFactors[1],
x) > 0)
2184 M (1, 1)=
mulNTL (bufFactors [0], bufFactors[1] [0]);
2186 mulNTL (bufFactors [0], bufFactors[1] [1])*
x;
2190 M (1, 1)=
mulNTL (bufFactors [0], bufFactors[1]);
2194 for (
i= 1;
i < Pi.
size();
i++)
2198 M (1,
i+1)=
mulNTL (Pi[
i-1] [0], bufFactors[
i+1] [0]);
2199 Pi [
i]=
M (1,
i+1) + (
mulNTL (Pi[
i-1] [1], bufFactors[
i+1] [0]) +
2200 mulNTL (Pi[
i-1] [0], bufFactors [
i+1] [1]))*
x;
2204 M (1,
i+1)=
mulNTL (Pi[
i-1] [0], bufFactors [
i+1]);
2205 Pi [
i]=
M(1,
i+1) +
mulNTL (Pi[
i-1] [1], bufFactors[
i+1])*
x;
2207 else if (
degree (bufFactors[
i+1],
x) > 0)
2209 M (1,
i+1)=
mulNTL (Pi[
i-1], bufFactors [
i+1] [0]);
2210 Pi [
i]=
M (1,
i+1) +
mulNTL (Pi[
i-1], bufFactors[
i+1] [1])*
x;
2214 M (1,
i+1)=
mulNTL (Pi [
i-1], bufFactors [
i+1]);
2219 for (
i= 1;
i <
l;
i++)
2223 for (
i= 0;
i < bufFactors.
size();
i++)
2224 factors.
append (bufFactors[
i]);
2243 ASSERT (
E.isUnivariate() ||
E.inCoeffDomain(),
2244 "constant or univariate poly expected");
2245 ASSERT (
i.getItem().isUnivariate() ||
i.getItem().inCoeffDomain(),
2246 "constant or univariate poly expected");
2247 ASSERT (
j.getItem().isUnivariate() ||
j.getItem().inCoeffDomain(),
2248 "constant or univariate poly expected");
2255 CFList bufFactors= factors;
2257 i.getItem()=
mod (
i.getItem(),
y);
2258 CFList bufProducts= products;
2260 i.getItem()=
mod (
i.getItem(),
y);
2273 e -=
j.getItem()*
i.getItem();
2278 for (
int i= 1;
i < d;
i++)
2287 recDiophantine=
diophantine (recResult, bufFactors, bufProducts,
buf,
2292 for (
j= recDiophantine;
j.hasItem();
j++,
k++,
l++)
2294 k.getItem() +=
j.getItem()*
power (
y,
i);
2295 e -=
l.getItem()*(
j.getItem()*
power (
y,
i));
2309 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
2314 const CFList& MOD,
bool& noOneToOne)
2323 for (
int i= 0;
i < factors.
length();
i++)
2328 test *= bufFactors[
i];
2333 DEBOUTLN (cerr,
"test in nonMonicHenselStep= " << test2);
2337 E= F[
j] - Pi [factors.
length() - 2] [
j];
2354 buf[
k]=
i.getItem();
2355 bufFactors[
k] += xToJ*
i.getItem();
2361 int degBuf0=
degree (bufFactors[0],
x);
2362 int degBuf1=
degree (bufFactors[1],
x);
2363 if (degBuf0 > 0 && degBuf1 > 0)
2365 M (
j + 1, 1)=
mulMod (bufFactors[0] [
j], bufFactors[1] [
j], MOD);
2366 if (
j + 2 <=
M.rows())
2367 M (
j + 2, 1)=
mulMod (bufFactors[0] [
j + 1], bufFactors[1] [
j + 1], MOD);
2373 if (degBuf0 > 0 && degBuf1 > 0)
2374 uIZeroJ=
mulMod (bufFactors[0] [0],
buf[1], MOD) +
2375 mulMod (bufFactors[1] [0],
buf[0], MOD);
2376 else if (degBuf0 > 0)
2377 uIZeroJ=
mulMod (
buf[0], bufFactors[1], MOD) +
2379 else if (degBuf1 > 0)
2380 uIZeroJ=
mulMod (bufFactors[0],
buf[1], MOD) +
2383 uIZeroJ=
mulMod (bufFactors[0],
buf[1], MOD) +
2385 Pi [0] += xToJ*uIZeroJ;
2388 for (
k= 0;
k < factors.
length() - 1;
k++)
2391 one= bufFactors [0];
2392 two= bufFactors [1];
2393 if (degBuf0 > 0 && degBuf1 > 0)
2397 for (
k= 1;
k <= (
j+1)/2;
k++)
2405 (bufFactors[1] [
k] + two.
coeff()), MOD) -
M (
k + 1, 1) -
2413 bufFactors[1] [
k], MOD) -
M (
k + 1, 1);
2418 tmp[0] +=
mulMod (bufFactors[0] [
k], (bufFactors[1] [
k] +
2419 two.
coeff()), MOD) -
M (
k + 1, 1);
2425 tmp[0] +=
M (
k + 1, 1);
2430 if (degBuf0 >=
j + 1 && degBuf1 >=
j + 1)
2432 if (
j + 2 <=
M.rows())
2433 tmp [0] +=
mulMod ((bufFactors [0] [
j + 1]+ bufFactors [0] [0]),
2434 (bufFactors [1] [
j + 1] + bufFactors [1] [0]), MOD)
2435 -
M(1,1) -
M (
j + 2,1);
2437 else if (degBuf0 >=
j + 1)
2440 tmp[0] +=
mulMod (bufFactors [0] [
j+1], bufFactors [1] [0], MOD);
2442 tmp[0] +=
mulMod (bufFactors [0] [
j+1], bufFactors [1], MOD);
2444 else if (degBuf1 >=
j + 1)
2447 tmp[0] +=
mulMod (bufFactors [0] [0], bufFactors [1] [
j + 1], MOD);
2449 tmp[0] +=
mulMod (bufFactors [0], bufFactors [1] [
j + 1], MOD);
2451 Pi [0] += tmp[0]*xToJ*F.
mvar();
2455 for (
int l= 1;
l < factors.
length() - 1;
l++)
2458 degBuf=
degree (bufFactors[
l + 1],
x);
2459 if (degPi > 0 && degBuf > 0)
2461 M (
j + 1,
l + 1)=
mulMod (Pi [
l - 1] [
j], bufFactors[
l + 1] [
j], MOD);
2462 if (
j + 2 <=
M.rows())
2463 M (
j + 2,
l + 1)=
mulMod (Pi [
l - 1] [
j + 1], bufFactors[
l + 1] [
j + 1],
2467 M (
j + 1,
l + 1)= 0;
2469 if (degPi > 0 && degBuf > 0)
2470 uIZeroJ=
mulMod (Pi[
l - 1] [0],
buf[
l + 1], MOD) +
2471 mulMod (uIZeroJ, bufFactors[
l + 1] [0], MOD);
2473 uIZeroJ=
mulMod (uIZeroJ, bufFactors[
l + 1], MOD) +
2475 else if (degBuf > 0)
2477 mulMod (uIZeroJ, bufFactors[
l + 1][0], MOD);
2480 mulMod (uIZeroJ, bufFactors[
l + 1], MOD);
2482 Pi [
l] += xToJ*uIZeroJ;
2484 one= bufFactors [
l + 1];
2486 if (degBuf > 0 && degPi > 0)
2490 for (
k= 1;
k <= (
j+1)/2;
k++)
2498 (Pi[
l - 1] [
k] + two.
coeff()), MOD) -
M (
k + 1,
l + 1) -
2499 M (
j -
k + 2,
l + 1);
2506 Pi[
l - 1] [
k], MOD) -
M (
k + 1,
l + 1);
2511 tmp[
l] +=
mulMod (bufFactors[
l + 1] [
k],
2512 (Pi[
l - 1] [
k] + two.
coeff()), MOD) -
M (
k + 1,
l + 1);
2517 tmp[
l] +=
M (
k + 1,
l + 1);
2521 if (degPi >=
j + 1 && degBuf >=
j + 1)
2523 if (
j + 2 <=
M.rows())
2524 tmp [
l] +=
mulMod ((Pi [
l - 1] [
j + 1]+ Pi [
l - 1] [0]),
2525 (bufFactors [
l + 1] [
j + 1] + bufFactors [
l + 1] [0])
2526 , MOD) -
M(1,
l+1) -
M (
j + 2,
l+1);
2528 else if (degPi >=
j + 1)
2531 tmp[
l] +=
mulMod (Pi [
l - 1] [
j+1], bufFactors [
l + 1] [0], MOD);
2533 tmp[
l] +=
mulMod (Pi [
l - 1] [
j+1], bufFactors [
l + 1], MOD);
2535 else if (degBuf >=
j + 1)
2538 tmp[
l] +=
mulMod (Pi [
l - 1] [0], bufFactors [
l + 1] [
j + 1], MOD);
2540 tmp[
l] +=
mulMod (Pi [
l - 1], bufFactors [
l + 1] [
j + 1], MOD);
2543 Pi[
l] += tmp[
l]*xToJ*F.
mvar();
2564 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
2572 int liftBoundBivar=
l[
k];
2595 Pi[0]=
mod (Pi[0],
power (
v, liftBoundBivar));
2597 if (
degree (bufFactors[0],
y) > 0 &&
degree (bufFactors [1],
y) > 0)
2598 Pi [0] += (
mulMod (bufFactors [0] [1], bufFactors[1] [0], MOD) +
2599 mulMod (bufFactors [0] [0], bufFactors [1] [1], MOD))*
y;
2600 else if (
degree (bufFactors[0],
y) > 0)
2601 Pi [0] +=
mulMod (bufFactors [0] [1], bufFactors[1], MOD)*
y;
2602 else if (
degree (bufFactors[1],
y) > 0)
2603 Pi [0] +=
mulMod (bufFactors [0], bufFactors[1] [1], MOD)*
y;
2606 for (
int i= 0;
i < bufFactors.
size();
i++)
2614 for (
int d= 1; d <
l[1]; d++)
2628 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
2643 Pi [0]=
mod (Pi[0], xToLOld);
2646 if (
degree (bufFactors[0],
y) > 0 &&
degree (bufFactors [1],
y) > 0)
2647 Pi [0] += (
mulMod (bufFactors [0] [1], bufFactors[1] [0], MOD) +
2648 mulMod (bufFactors [0] [0], bufFactors [1] [1], MOD))*
y;
2649 else if (
degree (bufFactors[0],
y) > 0)
2650 Pi [0] +=
mulMod (bufFactors [0] [1], bufFactors[1], MOD)*
y;
2651 else if (
degree (bufFactors[1],
y) > 0)
2652 Pi [0] +=
mulMod (bufFactors [0], bufFactors[1] [1], MOD)*
y;
2656 for (
int i= 0;
i < bufFactors.
size();
i++)
2678 for (
int d= 1; d < lNew; d++)
2693 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
2699 CFList bufDiophant= diophant;
2713 for (
int i= 0;
i < 2;
i++)
2728 for (
int i= 2;
i < lLength &&
j.hasItem();
i++,
j++, jj++, jjj++)
2735 l[
i - 1],
l[
i], bufLCs1, bufLCs2,
bad);
2747 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
2751 int bivarLiftBound,
bool&
bad)
2753 CFList bufFactors2= factors;
2757 i.getItem()=
mod (
i.getItem(),
y);
2760 bufF=
mod (bufF,
y);
2780 if (
degree (bufFactors[0],
v) > 0 &&
degree (bufFactors [1],
v) > 0)
2782 M (1, 1)=
mulMod2 (bufFactors [0] [0], bufFactors[1] [0], yToL);
2783 Pi [0]=
M (1,1) + (
mulMod2 (bufFactors [0] [1], bufFactors[1] [0], yToL) +
2784 mulMod2 (bufFactors [0] [0], bufFactors [1] [1], yToL))*
v;
2786 else if (
degree (bufFactors[0],
v) > 0)
2788 M (1,1)=
mulMod2 (bufFactors [0] [0], bufFactors [1], yToL);
2789 Pi [0]=
M(1,1) +
mulMod2 (bufFactors [0] [1], bufFactors[1], yToL)*
v;
2791 else if (
degree (bufFactors[1],
v) > 0)
2793 M (1,1)=
mulMod2 (bufFactors [0], bufFactors [1] [0], yToL);
2794 Pi [0]=
M (1,1) +
mulMod2 (bufFactors [0], bufFactors[1] [1], yToL)*
v;
2798 M (1,1)=
mulMod2 (bufFactors [0], bufFactors [1], yToL);
2802 for (
i= 1;
i < Pi.
size();
i++)
2806 M (1,
i+1)=
mulMod2 (Pi[
i-1] [0], bufFactors[
i+1] [0], yToL);
2807 Pi [
i]=
M (1,
i+1) + (
mulMod2 (Pi[
i-1] [1], bufFactors[
i+1] [0], yToL) +
2808 mulMod2 (Pi[
i-1] [0], bufFactors [
i+1] [1], yToL))*
v;
2812 M (1,
i+1)=
mulMod2 (Pi[
i-1] [0], bufFactors [
i+1], yToL);
2813 Pi [
i]=
M(1,
i+1) +
mulMod2 (Pi[
i-1] [1], bufFactors[
i+1], yToL)*
v;
2815 else if (
degree (bufFactors[
i+1],
v) > 0)
2817 M (1,
i+1)=
mulMod2 (Pi[
i-1], bufFactors [
i+1] [0], yToL);
2818 Pi [
i]=
M (1,
i+1) +
mulMod2 (Pi[
i-1], bufFactors[
i+1] [1], yToL)*
v;
2822 M (1,
i+1)=
mulMod2 (Pi [
i-1], bufFactors [
i+1], yToL);
2831 products.
append (bufF/
k.getItem());
2836 for (
int d= 1; d < liftBound; d++)
2851 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
2855 int& lNew,
const CFList& MOD,
bool& noOneToOne
2869 Pi [0]=
mod (Pi[0], xToLOld);
2872 if (
degree (bufFactors[0],
y) > 0 &&
degree (bufFactors [1],
y) > 0)
2873 Pi [0] += (
mulMod (bufFactors [0] [1], bufFactors[1] [0], MOD) +
2874 mulMod (bufFactors [0] [0], bufFactors [1] [1], MOD))*
y;
2875 else if (
degree (bufFactors[0],
y) > 0)
2876 Pi [0] +=
mulMod (bufFactors [0] [1], bufFactors[1], MOD)*
y;
2877 else if (
degree (bufFactors[1],
y) > 0)
2878 Pi [0] +=
mulMod (bufFactors [0], bufFactors[1] [1], MOD)*
y;
2880 for (
int i= 1;
i < Pi.
size();
i++)
2882 Pi [
i]=
mod (Pi [
i], xToLOld);
2883 M (1,
i + 1)= Pi [
i];
2886 Pi [
i] += (
mulMod (Pi[
i-1] [1], bufFactors[
i+1] [0], MOD) +
2887 mulMod (Pi[
i-1] [0], bufFactors [
i+1] [1], MOD))*
y;
2889 Pi [
i] +=
mulMod (Pi[
i-1] [1], bufFactors[
i+1], MOD)*
y;
2890 else if (
degree (bufFactors[
i+1],
y) > 0)
2891 Pi [
i] +=
mulMod (Pi[
i-1], bufFactors[
i+1] [1], MOD)*
y;
2898 for (
int i= 0;
i < bufFactors.
size();
i++)
2902 if (!
fdivides (bufFactors[
i] [0], bufF, quot))
2911 if (!
fdivides (bufFactors[
i], bufF, quot))
2921 for (
int d= 1; d < lNew; d++)
2924 products, d, MOD, noOneToOne);
2936 #if defined(HAVE_NTL) || defined(HAVE_FLINT)
2940 int* liftBound,
int length,
bool& noOneToOne
2943 CFList bufDiophant= diophant;
2952 liftBound[1], liftBound[0], noOneToOne);
2963 for (
int i= 0;
i < 2;
i++)
2971 for (
int i= 2;
i <=
length &&
j.hasItem();
i++,
j++,
k++)
2977 liftBound[
i-1], liftBound[
i], MOD, noOneToOne);
CanonicalForm convertFq_poly_t2FacCF(const fq_poly_t p, const Variable &x, const Variable &alpha, const fq_ctx_t ctx)
conversion of a FLINT poly over Fq (for non-word size p) to a CanonicalForm with alg....
CanonicalForm convertFq_nmod_poly_t2FacCF(const fq_nmod_poly_t p, const Variable &x, const Variable &alpha, const fq_nmod_ctx_t ctx)
conversion of a FLINT poly over Fq to a CanonicalForm with alg. variable alpha and polynomial variabl...
void convertFacCF2Fq_nmod_t(fq_nmod_t result, const CanonicalForm &f, const fq_nmod_ctx_t ctx)
conversion of a factory element of F_q to a FLINT fq_nmod_t, does not do any memory allocation for po...
void convertFacCF2Fmpz_mod_poly_t(fmpz_mod_poly_t result, const CanonicalForm &f, const fmpz_t p)
conversion of a factory univariate poly over Z to a FLINT poly over Z/p (for non word size p)
void convertFacCF2Fq_nmod_poly_t(fq_nmod_poly_t result, const CanonicalForm &f, const fq_nmod_ctx_t ctx)
conversion of a factory univariate poly over F_q to a FLINT fq_nmod_poly_t
void convertCF2initFmpz(fmpz_t result, const CanonicalForm &f)
conversion of a factory integer to fmpz_t(init.)
void convertFacCF2Fq_poly_t(fq_poly_t result, const CanonicalForm &f, const fq_ctx_t ctx)
conversion of a factory univariate poly over F_q (for non-word size p) to a FLINT fq_poly_t
This file defines functions for conversion to FLINT (www.flintlib.org) and back.
ZZX convertFacCF2NTLZZX(const CanonicalForm &f)
zz_pEX convertFacCF2NTLzz_pEX(const CanonicalForm &f, const zz_pX &mipo)
CanonicalForm convertNTLzz_pEX2CF(const zz_pEX &f, const Variable &x, const Variable &alpha)
ZZ_pEX convertFacCF2NTLZZ_pEX(const CanonicalForm &f, const ZZ_pX &mipo)
CanonicalForm in Z_p(a)[X] to NTL ZZ_pEX.
CanonicalForm convertNTLZZ_pEX2CF(const ZZ_pEX &f, const Variable &x, const Variable &alpha)
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Conversion to and from NTL.
void tryInvert(const CanonicalForm &F, const CanonicalForm &M, CanonicalForm &inv, bool &fail)
void tryNTLXGCD(zz_pEX &d, zz_pEX &s, zz_pEX &t, const zz_pEX &a, const zz_pEX &b, bool &fail)
compute the extended GCD d=s*a+t*b, fail is set to true if a zero divisor is encountered
This file defines functions for univariate GCD and extended GCD over Z/p[t]/(f)[x] for reducible f.
CanonicalForm extgcd(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &a, CanonicalForm &b)
CanonicalForm extgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a,...
univariate Gcd over finite fields and Z, extended GCD over finite fields and Q
CanonicalForm bCommonDen(const CanonicalForm &f)
CanonicalForm bCommonDen ( const CanonicalForm & f )
CanonicalForm maxNorm(const CanonicalForm &f)
CanonicalForm maxNorm ( const CanonicalForm & f )
bool fdivides(const CanonicalForm &f, const CanonicalForm &g)
bool fdivides ( const CanonicalForm & f, const CanonicalForm & g )
declarations of higher level algorithms.
#define ASSERT(expression, message)
static const int SW_RATIONAL
set to 1 for computations over Q
static CanonicalForm bound(const CFMatrix &M)
int cf_getBigPrime(int i)
class to iterate through CanonicalForm's
CF_NO_INLINE int exp() const
get the current exponent
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
factory's class for variables
class to do operations mod p^k for int's p and k
functions to print debug output
#define DEBOUTLN(stream, objects)
const CanonicalForm int s
const CanonicalForm int const CFList const Variable & y
REvaluation E(1, terms.length(), IntRandom(25))
TIMING_END_AND_PRINT(fac_alg_resultant, "time to compute resultant0: ")
TIMING_START(fac_alg_resultant)
int hasAlgVar(const CanonicalForm &f, const Variable &v)
modpk coeffBound(const CanonicalForm &f, int p, const CanonicalForm &mipo)
compute p^k larger than the bound on the coefficients of a factor of f over Q (mipo)
void findGoodPrime(const CanonicalForm &f, int &start)
find a big prime p from our tables such that no term of f vanishes mod p
bivariate factorization over Q(a)
const Variable & v
< [in] a sqrfree bivariate poly
CFList diophantineHenselQa(const CanonicalForm &F, const CanonicalForm &G, const CFList &factors, modpk &b, const Variable &alpha)
solve mod over by p-adic lifting
CFList nonMonicHenselLift(const CFList &F, const CFList &factors, const CFList &LCs, CFList &diophant, CFArray &Pi, CFMatrix &M, int lOld, int &lNew, const CFList &MOD, bool &noOneToOne)
CFList biDiophantine(const CanonicalForm &F, const CFList &factors, int d)
static int mod(const CFList &L, const CanonicalForm &p)
CFList henselLift23(const CFList &eval, const CFList &factors, int *l, CFList &diophant, CFArray &Pi, CFMatrix &M)
Hensel lifting from bivariate to trivariate.
CFList nonMonicHenselLift23(const CanonicalForm &F, const CFList &factors, const CFList &LCs, CFList &diophant, CFArray &Pi, int liftBound, int bivarLiftBound, bool &bad)
fq_nmod_ctx_clear(fq_con)
static CFList Farey(const CFList &L, const CanonicalForm &q)
static void chineseRemainder(const CFList &x1, const CanonicalForm &q1, const CFList &x2, const CanonicalForm &q2, CFList &xnew, CanonicalForm &qnew)
nmod_poly_init(FLINTmipo, getCharacteristic())
fq_nmod_ctx_init_modulus(fq_con, FLINTmipo, "Z")
void henselLift12(const CanonicalForm &F, CFList &factors, int l, CFArray &Pi, CFList &diophant, CFMatrix &M, modpk &b, bool sort)
Hensel lift from univariate to bivariate.
CFList modularDiophant(const CanonicalForm &f, const CFList &factors, const CanonicalForm &M)
fq_nmod_poly_init(prod, fq_con)
CFList nonMonicHenselLift2(const CFList &F, const CFList &factors, const CFList &MOD, CFList &diophant, CFArray &Pi, CFMatrix &M, int lOld, int &lNew, const CFList &LCs1, const CFList &LCs2, bool &bad)
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
CanonicalForm replaceLC(const CanonicalForm &F, const CanonicalForm &c)
CFList diophantine(const CanonicalForm &F, const CFList &factors)
static CFList replacevar(const CFList &L, const Variable &a, const Variable &b)
void nonMonicHenselLift12(const CanonicalForm &F, CFList &factors, int l, CFArray &Pi, CFList &diophant, CFMatrix &M, const CFArray &LCs, bool sort)
Hensel lifting from univariate to bivariate, factors need not to be monic.
CFList diophantineQa(const CanonicalForm &F, const CanonicalForm &G, const CFList &factors, modpk &b, const Variable &alpha)
solve mod over by first computing mod and if no zero divisor occurred compute it mod
void nonMonicHenselStep(const CanonicalForm &F, const CFList &factors, CFArray &bufFactors, const CFList &diophant, CFMatrix &M, CFArray &Pi, const CFList &products, int j, const CFList &MOD, bool &noOneToOne)
TIMING_DEFINE_PRINT(diotime) TIMING_DEFINE_PRINT(product1) TIMING_DEFINE_PRINT(product2) TIMING_DEFINE_PRINT(hensel23) TIMING_DEFINE_PRINT(hensel) static CFList productsFLINT(const CFList &factors
convertFacCF2nmod_poly_t(FLINTmipo, M)
void henselLiftResume12(const CanonicalForm &F, CFList &factors, int start, int end, CFArray &Pi, const CFList &diophant, CFMatrix &M, const modpk &b)
resume Hensel lift from univariate to bivariate. Assumes factors are lifted to precision Variable (2)...
CFList nonMonicHenselLift232(const CFList &eval, const CFList &factors, int *l, CFList &diophant, CFArray &Pi, CFMatrix &M, const CFList &LCs1, const CFList &LCs2, bool &bad)
static CFList mapinto(const CFList &L)
CFList henselLift(const CFList &F, const CFList &factors, const CFList &MOD, CFList &diophant, CFArray &Pi, CFMatrix &M, int lOld, int lNew)
Hensel lifting.
CFList multiRecDiophantine(const CanonicalForm &F, const CFList &factors, const CFList &recResult, const CFList &M, int d)
nmod_poly_clear(FLINTmipo)
static void henselStep(const CanonicalForm &F, const CFList &factors, CFArray &bufFactors, const CFList &diophant, CFMatrix &M, CFArray &Pi, int j, const CFList &MOD)
static void tryDiophantine(CFList &result, const CanonicalForm &F, const CFList &factors, const CanonicalForm &M, bool &fail)
void nonMonicHenselStep12(const CanonicalForm &F, const CFList &factors, CFArray &bufFactors, const CFList &diophant, CFMatrix &M, CFArray &Pi, int j, const CFArray &)
void henselStep12(const CanonicalForm &F, const CFList &factors, CFArray &bufFactors, const CFList &diophant, CFMatrix &M, CFArray &Pi, int j, const modpk &b)
void henselLiftResume(const CanonicalForm &F, CFList &factors, int start, int end, CFArray &Pi, const CFList &diophant, CFMatrix &M, const CFList &MOD)
resume Hensel lifting.
void sortList(CFList &list, const Variable &x)
sort a list of polynomials by their degree in x.
CFList diophantineHensel(const CanonicalForm &F, const CFList &factors, const modpk &b)
fq_nmod_poly_clear(prod, fq_con)
This file defines functions for Hensel lifting.
CanonicalForm mulNTL(const CanonicalForm &F, const CanonicalForm &G, const modpk &b)
multiplication of univariate polys using FLINT/NTL over F_p, F_q, Z/p^k, Z/p^k[t]/(f),...
CanonicalForm mulMod2(const CanonicalForm &A, const CanonicalForm &B, const CanonicalForm &M)
Karatsuba style modular multiplication for bivariate polynomials.
CanonicalForm mulMod(const CanonicalForm &A, const CanonicalForm &B, const CFList &MOD)
Karatsuba style modular multiplication for multivariate polynomials.
CanonicalForm divNTL(const CanonicalForm &F, const CanonicalForm &G, const modpk &b)
division of univariate polys using FLINT/NTL over F_p, F_q, Z/p^k, Z/p^k[t]/(f), Z,...
CanonicalForm modNTL(const CanonicalForm &F, const CanonicalForm &G, const modpk &b)
mod of univariate polys using FLINT/NTL over F_p, F_q, Z/p^k, Z/p^k[t]/(f), Z, Q, Q(a),...
This file defines functions for fast multiplication and division with remainder.
void sort(CFArray &A, int l=0)
quick sort A
CanonicalForm remainder(const CanonicalForm &f, const CanonicalForm &g, const modpk &pk)
CanonicalForm replaceLc(const CanonicalForm &f, const CanonicalForm &c)
operations mod p^k and some other useful functions for factorization
void setReduce(const Variable &alpha, bool reduce)
Variable FACTORY_PUBLIC rootOf(const CanonicalForm &, char name='@')
returns a symbolic root of polynomial with name name Use it to define algebraic variables
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
static BOOLEAN length(leftv result, leftv arg)
int status int void size_t count