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
937{
941 {
942 return 0;
943 }
945 {
947 {
949 {
953#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
954 fmpz_t FLINTp;
955 fmpz_mod_poly_t FLINTmipo;
957 fq_t FLINTF, FLINTG;
958
959 fmpz_init (FLINTp);
961
963
964 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
965 fmpz_mod_ctx_t fmpz_ctx;
966 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
967 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
968 #else
969 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
970 #endif
971
974
975 fq_inv (FLINTG, FLINTG,
fq_con);
976 fq_mul (FLINTF, FLINTF, FLINTG,
fq_con);
977
979
980 fmpz_clear (FLINTp);
981 fq_clear (FLINTF,
fq_con);
982 fq_clear (FLINTG,
fq_con);
984 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
985 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
986 fmpz_mod_ctx_clear(fmpz_ctx);
987 #else
988 fmpz_mod_poly_clear (FLINTmipo);
989 #endif
991#else
994 ZZ_pE::init (NTLmipo);
998 div (
result, to_ZZ_pE (NTLf), to_ZZ_pE (NTLg));
1000#endif
1001 }
1002 return b(
div (F,
G));
1003 }
1005 }
1007 {
1009 {
1010 if (!
G.inBaseDomain())
1011 {
1014#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1015 fmpz_t FLINTp;
1016 fmpz_mod_poly_t FLINTmipo;
1018 fq_poly_t FLINTF;
1019 fq_t FLINTG;
1020
1021 fmpz_init (FLINTp);
1023
1025
1026 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1027 fmpz_mod_ctx_t fmpz_ctx;
1028 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
1029 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
1030 #else
1031 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
1032 #endif
1033
1036
1037 fq_inv (FLINTG, FLINTG,
fq_con);
1038 fq_poly_scalar_mul_fq (FLINTF, FLINTF, FLINTG,
fq_con);
1039
1042
1043 fmpz_clear (FLINTp);
1044 fq_poly_clear (FLINTF,
fq_con);
1045 fq_clear (FLINTG,
fq_con);
1047 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1048 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
1049 fmpz_mod_ctx_clear(fmpz_ctx);
1050 #else
1051 fmpz_mod_poly_clear (FLINTmipo);
1052 #endif
1054#else
1057 ZZ_pE::init (NTLmipo);
1060 div (NTLf, NTLf, to_ZZ_pE (NTLg));
1062#endif
1063 }
1064 return b(
div (F,
G));
1065 }
1067 }
1068
1070 {
1071
1074 {
1075#ifdef HAVE_FLINT
1077 {
1078 fmpz_t FLINTpk;
1079 fmpz_init (FLINTpk);
1081 fmpz_mod_poly_t FLINTF, FLINTG;
1084 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1085 fmpz_mod_ctx_t fmpz_ctx;
1086 fmpz_mod_ctx_init(fmpz_ctx,FLINTpk);
1087 fmpz_mod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG, fmpz_ctx);
1088 #else
1089 fmpz_mod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG);
1090 #endif
1092 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1093 fmpz_mod_poly_clear (FLINTG, fmpz_ctx);
1094 fmpz_mod_poly_clear (FLINTF, fmpz_ctx);
1095 fmpz_mod_ctx_clear(fmpz_ctx);
1096 #else
1097 fmpz_mod_poly_clear (FLINTG);
1098 fmpz_mod_poly_clear (FLINTF);
1099 #endif
1100 fmpz_clear (FLINTpk);
1102 }
1104#else
1106 {
1110 ZZ_pX NTLf= to_ZZ_pX (ZZf);
1111 ZZ_pX NTLg= to_ZZ_pX (ZZg);
1112 div (NTLf, NTLf, NTLg);
1114 }
1116#endif
1117 }
1118 else
1119 {
1121 {
1122#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1123 fmpz_t FLINTp;
1124 fmpz_mod_poly_t FLINTmipo;
1126 fq_poly_t FLINTF, FLINTG;
1127
1128 fmpz_init (FLINTp);
1130
1132
1133 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1134 fmpz_mod_ctx_t fmpz_ctx;
1135 fmpz_mod_ctx_init(fmpz_ctx,FLINTp);
1136 fq_ctx_init_modulus (
fq_con, FLINTmipo, fmpz_ctx,
"Z");
1137 #else
1138 fq_ctx_init_modulus (
fq_con, FLINTmipo,
"Z");
1139 #endif
1140
1143
1144 fq_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG,
fq_con);
1145
1148
1149 fmpz_clear (FLINTp);
1150 fq_poly_clear (FLINTF,
fq_con);
1151 fq_poly_clear (FLINTG,
fq_con);
1153 #if (HAVE_FLINT && __FLINT_RELEASE >= 20700)
1154 fmpz_mod_poly_clear (FLINTmipo, fmpz_ctx);
1155 fmpz_mod_ctx_clear(fmpz_ctx);
1156 #else
1157 fmpz_mod_poly_clear (FLINTmipo);
1158 #endif
1160#else
1163 ZZ_pE::init (NTLmipo);
1166 div (NTLf, NTLf, NTLg);
1168#endif
1169 }
1170#ifdef HAVE_FLINT
1174#else
1176#endif
1177 }
1178 }
1179
1181 ASSERT (F.
level() ==
G.level(),
"expected polys of same level");
1182#if (!defined(HAVE_FLINT) || __FLINT_RELEASE < 20400)
1184 {
1187 }
1188#endif
1192 {
1193#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
1194 nmod_poly_t FLINTmipo;
1196
1199
1201
1202 fq_nmod_poly_t FLINTF, FLINTG;
1205
1206 fq_nmod_poly_divrem (FLINTF, FLINTG, FLINTF, FLINTG,
fq_con);
1207
1209
1214#else
1216 zz_pE::init (NTLMipo);
1219 div (NTLF, NTLF, NTLG);
1221#endif
1222 }
1223 else
1224 {
1225#ifdef HAVE_FLINT
1226 nmod_poly_t FLINTF, FLINTG;
1229 nmod_poly_div (FLINTF, FLINTF, FLINTG);
1233#else
1236 div (NTLF, NTLF, NTLG);
1238#endif
1239 }
1241}
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)