division of univariate polys using FLINT/NTL over F_p, F_q, Z/p^k, Z/p^k[t]/(f), Z, Q, Q(a), if we are in GF factory's default multiplication is used. If b!= 0 and getCharacteristic() == 0 the input will be considered as elements over Z/p^k or Z/p^k[t]/(f); in this case invertiblity of Lc(G) is not checked
939{
943 {
944 return 0;
945 }
947 {
949 {
951 {
955#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
956 fmpz_t FLINTp;
957 fmpz_mod_poly_t FLINTmipo;
959 fq_t FLINTF, FLINTG;
960
961 fmpz_init (FLINTp);
963
965
966 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
967 fmpz_mod_ctx_t fmpz_ctx;
968 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
969 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
970 #else
971 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
972 #endif
973
976
977 fq_inv (FLINTG, FLINTG,
fq_con);
978 fq_mul (FLINTF, FLINTF, FLINTG,
fq_con);
979
981
982 fmpz_clear (FLINTp);
983 fq_clear (FLINTF,
fq_con);
984 fq_clear (FLINTG,
fq_con);
986 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
987 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
988 fmpz_mod_ctx_clear(fmpz_ctx);
989 #else
990 fmpz_mod_poly_clear (FLINTmipo);
991 #endif
993#else
1000 div (
result, to_ZZ_pE (NTLf), to_ZZ_pE (NTLg));
1002#endif
1003 }
1004 return b(
div (F,
G));
1005 }
1007 }
1009 {
1011 {
1012 if (!
G.inBaseDomain())
1013 {
1016#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1017 fmpz_t FLINTp;
1018 fmpz_mod_poly_t FLINTmipo;
1020 fq_poly_t FLINTF;
1021 fq_t FLINTG;
1022
1023 fmpz_init (FLINTp);
1025
1027
1028 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1029 fmpz_mod_ctx_t fmpz_ctx;
1030 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
1031 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
1032 #else
1033 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
1034 #endif
1035
1038
1039 fq_inv (FLINTG, FLINTG,
fq_con);
1040 fq_poly_scalar_mul_fq (FLINTF, FLINTF, FLINTG,
fq_con);
1041
1044
1045 fmpz_clear (FLINTp);
1046 fq_poly_clear (FLINTF,
fq_con);
1047 fq_clear (FLINTG,
fq_con);
1049 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1050 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
1051 fmpz_mod_ctx_clear(fmpz_ctx);
1052 #else
1053 fmpz_mod_poly_clear (FLINTmipo);
1054 #endif
1056#else
1062 div (NTLf, NTLf, to_ZZ_pE (NTLg));
1064#endif
1065 }
1066 return b(
div (F,
G));
1067 }
1069 }
1070
1072 {
1073
1076 {
1077#ifdef HAVE_FLINT
1079 {
1080 fmpz_t FLINTpk;
1081 fmpz_init (FLINTpk);
1083 fmpz_mod_poly_t FLINTF, FLINTG;
1086 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1087 fmpz_mod_ctx_t fmpz_ctx;
1088 fmpz_mod_ctx_init(fmpz_ctx,FLINTpk);
1089 fmpz_mod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG, fmpz_ctx);
1090 #else
1091 fmpz_mod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG);
1092 #endif
1094 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1095 fmpz_mod_poly_clear (FLINTG, fmpz_ctx);
1096 fmpz_mod_poly_clear (FLINTF, fmpz_ctx);
1097 fmpz_mod_ctx_clear(fmpz_ctx);
1098 #else
1099 fmpz_mod_poly_clear (FLINTG);
1100 fmpz_mod_poly_clear (FLINTF);
1101 #endif
1102 fmpz_clear (FLINTpk);
1104 }
1106#else
1108 {
1112 ZZ_pX NTLf= to_ZZ_pX (ZZf);
1113 ZZ_pX NTLg= to_ZZ_pX (ZZg);
1114 div (NTLf, NTLf, NTLg);
1116 }
1118#endif
1119 }
1120 else
1121 {
1123 {
1124#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1125 fmpz_t FLINTp;
1126 fmpz_mod_poly_t FLINTmipo;
1128 fq_poly_t FLINTF, FLINTG;
1129
1130 fmpz_init (FLINTp);
1132
1134
1135 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1136 fmpz_mod_ctx_t fmpz_ctx;
1137 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
1138 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
1139 #else
1140 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
1141 #endif
1142
1145
1146 fq_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG,
fq_con);
1147
1150
1151 fmpz_clear (FLINTp);
1152 fq_poly_clear (FLINTF,
fq_con);
1153 fq_poly_clear (FLINTG,
fq_con);
1155 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1156 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
1157 fmpz_mod_ctx_clear(fmpz_ctx);
1158 #else
1159 fmpz_mod_poly_clear (FLINTmipo);
1160 #endif
1162#else
1168 div (NTLf, NTLf, NTLg);
1170#endif
1171 }
1172#ifdef HAVE_FLINT
1176#else
1178#endif
1179 }
1180 }
1181
1183 ASSERT (F.
level() ==
G.level(),
"expected polys of same level");
1184#if (!defined(HAVE_FLINT) || __FLINT_RELEASE < 20400)
1186 {
1189 }
1190#endif
1194 {
1195#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1196 nmod_poly_t FLINTmipo;
1198
1201
1203
1204 fq_nmod_poly_t FLINTF, FLINTG;
1207
1208 fq_nmod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG,
fq_con);
1209
1211
1216#else
1221 div (NTLF, NTLF, NTLG);
1223#endif
1224 }
1225 else
1226 {
1227#ifdef HAVE_FLINT
1228 nmod_poly_t FLINTF, FLINTG;
1231 nmod_poly_div (FLINTF, FLINTF, FLINTG);
1235#else
1238 div (NTLF, NTLF, NTLG);
1240#endif
1241 }
1243}
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....
void convertFacCF2Fq_t(fq_t result, const CanonicalForm &f, const fq_ctx_t ctx)
conversion of a factory element of F_q (for non-word size p) to a FLINT fq_t
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...
CanonicalForm convertFq_t2FacCF(const fq_t poly, const Variable &alpha)
conversion of a FLINT element of F_q with non-word size p to a CanonicalForm with alg....
CanonicalForm convertFmpz_mod_poly_t2FacCF(const fmpz_mod_poly_t poly, const Variable &x, const modpk &b)
conversion of a FLINT poly over Z/p (for non word size p) to a CanonicalForm over Z
CanonicalForm convertnmod_poly_t2FacCF(const nmod_poly_t poly, const Variable &x)
conversion of a FLINT poly over Z/p to CanonicalForm
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
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 convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
CanonicalForm convertNTLZZpX2CF(const ZZ_pX &poly, const Variable &x)
NAME: convertNTLZZpX2CF.
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
CanonicalForm convertNTLZZ_pEX2CF(const ZZ_pEX &f, const Variable &x, const Variable &alpha)
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
ZZ_pX convertFacCF2NTLZZpX(const CanonicalForm &f)
NAME: convertFacCF2NTLZZpX.
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
#define ASSERT(expression, message)
#define GaloisFieldDomain
factory's class for variables
fq_nmod_ctx_clear(fq_con)
nmod_poly_init(FLINTmipo, getCharacteristic())
fq_nmod_ctx_init_modulus(fq_con, FLINTmipo, "Z")
convertFacCF2nmod_poly_t(FLINTmipo, M)
nmod_poly_clear(FLINTmipo)
fq_nmod_poly_clear(prod, fq_con)
CanonicalForm divFLINTQ(const CanonicalForm &F, const CanonicalForm &G)
void newtonDiv(const CanonicalForm &F, const CanonicalForm &G, CanonicalForm &Q)
CanonicalForm getMipo(const Variable &alpha, const Variable &x)