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
941{
945 {
946 return 0;
947 }
949 {
951 {
953 {
957#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
958 fmpz_t FLINTp;
959 fmpz_mod_poly_t FLINTmipo;
961 fq_t FLINTF, FLINTG;
962
963 fmpz_init (FLINTp);
965
967
968 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
969 fmpz_mod_ctx_t fmpz_ctx;
970 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
971 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
972 #else
973 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
974 #endif
975
978
979 fq_inv (FLINTG, FLINTG,
fq_con);
980 fq_mul (FLINTF, FLINTF, FLINTG,
fq_con);
981
983
984 fmpz_clear (FLINTp);
985 fq_clear (FLINTF,
fq_con);
986 fq_clear (FLINTG,
fq_con);
988 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
989 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
990 fmpz_mod_ctx_clear(fmpz_ctx);
991 #else
992 fmpz_mod_poly_clear (FLINTmipo);
993 #endif
995#else
1002 div (
result, to_ZZ_pE (NTLf), to_ZZ_pE (NTLg));
1004#endif
1005 }
1006 return b(
div (F,
G));
1007 }
1009 }
1011 {
1013 {
1014 if (!
G.inBaseDomain())
1015 {
1018#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1019 fmpz_t FLINTp;
1020 fmpz_mod_poly_t FLINTmipo;
1022 fq_poly_t FLINTF;
1023 fq_t FLINTG;
1024
1025 fmpz_init (FLINTp);
1027
1029
1030 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1031 fmpz_mod_ctx_t fmpz_ctx;
1032 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
1033 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
1034 #else
1035 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
1036 #endif
1037
1040
1041 fq_inv (FLINTG, FLINTG,
fq_con);
1042 fq_poly_scalar_mul_fq (FLINTF, FLINTF, FLINTG,
fq_con);
1043
1046
1047 fmpz_clear (FLINTp);
1048 fq_poly_clear (FLINTF,
fq_con);
1049 fq_clear (FLINTG,
fq_con);
1051 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1052 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
1053 fmpz_mod_ctx_clear(fmpz_ctx);
1054 #else
1055 fmpz_mod_poly_clear (FLINTmipo);
1056 #endif
1058#else
1064 div (NTLf, NTLf, to_ZZ_pE (NTLg));
1066#endif
1067 }
1068 return b(
div (F,
G));
1069 }
1071 }
1072
1074 {
1075
1078 {
1079#ifdef HAVE_FLINT
1081 {
1082 fmpz_t FLINTpk;
1083 fmpz_init (FLINTpk);
1085 fmpz_mod_poly_t FLINTF, FLINTG;
1088 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1089 fmpz_mod_ctx_t fmpz_ctx;
1090 fmpz_mod_ctx_init(fmpz_ctx,FLINTpk);
1091 fmpz_mod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG, fmpz_ctx);
1092 #else
1093 fmpz_mod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG);
1094 #endif
1096 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1097 fmpz_mod_poly_clear (FLINTG, fmpz_ctx);
1098 fmpz_mod_poly_clear (FLINTF, fmpz_ctx);
1099 fmpz_mod_ctx_clear(fmpz_ctx);
1100 #else
1101 fmpz_mod_poly_clear (FLINTG);
1102 fmpz_mod_poly_clear (FLINTF);
1103 #endif
1104 fmpz_clear (FLINTpk);
1106 }
1108#else
1110 {
1114 ZZ_pX NTLf= to_ZZ_pX (ZZf);
1115 ZZ_pX NTLg= to_ZZ_pX (ZZg);
1116 div (NTLf, NTLf, NTLg);
1118 }
1120#endif
1121 }
1122 else
1123 {
1125 {
1126#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1127 fmpz_t FLINTp;
1128 fmpz_mod_poly_t FLINTmipo;
1130 fq_poly_t FLINTF, FLINTG;
1131
1132 fmpz_init (FLINTp);
1134
1136
1137 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1138 fmpz_mod_ctx_t fmpz_ctx;
1139 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
1140 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
1141 #else
1142 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
1143 #endif
1144
1147
1148 fq_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG,
fq_con);
1149
1152
1153 fmpz_clear (FLINTp);
1154 fq_poly_clear (FLINTF,
fq_con);
1155 fq_poly_clear (FLINTG,
fq_con);
1157 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1158 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
1159 fmpz_mod_ctx_clear(fmpz_ctx);
1160 #else
1161 fmpz_mod_poly_clear (FLINTmipo);
1162 #endif
1164#else
1170 div (NTLf, NTLf, NTLg);
1172#endif
1173 }
1174#ifdef HAVE_FLINT
1178#else
1180#endif
1181 }
1182 }
1183
1185 ASSERT (F.
level() ==
G.level(),
"expected polys of same level");
1186#if (!defined(HAVE_FLINT) || __FLINT_RELEASE < 20400)
1188 {
1191 }
1192#endif
1196 {
1197#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1198 nmod_poly_t FLINTmipo;
1200
1203
1205
1206 fq_nmod_poly_t FLINTF, FLINTG;
1209
1210 fq_nmod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG,
fq_con);
1211
1213
1218#else
1223 div (NTLF, NTLF, NTLG);
1225#endif
1226 }
1227 else
1228 {
1229#ifdef HAVE_FLINT
1230 nmod_poly_t FLINTF, FLINTG;
1233 nmod_poly_div (FLINTF, FLINTF, FLINTG);
1237#else
1240 div (NTLF, NTLF, NTLG);
1242#endif
1243 }
1245}
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)