File indexing completed on 2026-11-07 10:15:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef FMPQ_POLY_H
0015 #define FMPQ_POLY_H
0016
0017 #ifdef FMPQ_POLY_INLINES_C
0018 #define FMPQ_POLY_INLINE
0019 #else
0020 #define FMPQ_POLY_INLINE static inline
0021 #endif
0022
0023 #include "fmpq_types.h"
0024 #include "nmod_types.h"
0025
0026 #ifdef __cplusplus
0027 extern "C" {
0028 #endif
0029
0030
0031
0032 typedef struct
0033 {
0034 fmpq_poly_struct * powers;
0035 slong len;
0036 } fmpq_poly_powers_precomp_struct;
0037
0038 typedef fmpq_poly_powers_precomp_struct fmpq_poly_powers_precomp_t[1];
0039
0040 #define WEAK_CANONICALISE_CUTOFF 25600
0041
0042
0043
0044 void fmpq_poly_init(fmpq_poly_t poly);
0045
0046 void fmpq_poly_init2(fmpq_poly_t poly, slong alloc);
0047
0048 void fmpq_poly_realloc(fmpq_poly_t poly, slong alloc);
0049
0050 void fmpq_poly_fit_length(fmpq_poly_t poly, slong len);
0051
0052 void _fmpq_poly_set_length(fmpq_poly_t poly, slong len);
0053
0054 void fmpq_poly_clear(fmpq_poly_t poly);
0055
0056 void _fmpq_poly_normalise(fmpq_poly_t poly);
0057
0058
0059
0060 #define fmpq_poly_numref(poly) ((poly)->coeffs)
0061
0062 #define fmpq_poly_denref(poly) ((poly)->den)
0063
0064 void fmpq_poly_get_numerator(fmpz_poly_t res, const fmpq_poly_t poly);
0065 void fmpq_poly_get_denominator(fmpz_t den, const fmpq_poly_t poly);
0066
0067
0068
0069 void _fmpq_poly_canonicalise(fmpz * rpoly, fmpz_t den, slong len);
0070
0071 void fmpq_poly_canonicalise(fmpq_poly_t poly);
0072
0073 int _fmpq_poly_is_canonical(const fmpz * poly, const fmpz_t den, slong len);
0074
0075 int fmpq_poly_is_canonical(const fmpq_poly_t poly);
0076
0077
0078
0079 FMPQ_POLY_INLINE
0080 slong fmpq_poly_degree(const fmpq_poly_t poly)
0081 {
0082 return poly->length - 1;
0083 }
0084
0085 FMPQ_POLY_INLINE
0086 slong fmpq_poly_length(const fmpq_poly_t poly)
0087 {
0088 return poly->length;
0089 }
0090
0091
0092
0093 void fmpq_poly_randtest(fmpq_poly_t f, flint_rand_t state,
0094 slong len, flint_bitcnt_t bits_in);
0095
0096 void fmpq_poly_randtest_unsigned(fmpq_poly_t f, flint_rand_t state,
0097 slong len, flint_bitcnt_t bits_in);
0098
0099 void fmpq_poly_randtest_not_zero(fmpq_poly_t f, flint_rand_t state,
0100 slong len, flint_bitcnt_t bits_in);
0101
0102
0103
0104 void fmpq_poly_set(fmpq_poly_t poly1, const fmpq_poly_t poly2);
0105
0106 void fmpq_poly_set_si(fmpq_poly_t poly, slong x);
0107
0108 void fmpq_poly_set_ui(fmpq_poly_t poly, ulong x);
0109
0110 void fmpq_poly_set_fmpz(fmpq_poly_t poly, const fmpz_t x);
0111
0112 void fmpq_poly_set_fmpq(fmpq_poly_t poly, const fmpq_t x);
0113
0114 void fmpq_poly_set_fmpz_poly(fmpq_poly_t rop, const fmpz_poly_t op);
0115
0116 void _fmpq_poly_get_nmod_poly(nmod_poly_t rop, const fmpq_poly_t op);
0117
0118 void fmpq_poly_get_nmod_poly_den(nmod_poly_t rop, const fmpq_poly_t op, int den);
0119
0120 void fmpq_poly_get_nmod_poly(nmod_poly_t rop, const fmpq_poly_t op);
0121
0122 void fmpq_poly_set_nmod_poly(fmpq_poly_t rop, const nmod_poly_t op);
0123
0124 int _fmpq_poly_set_str(fmpz * poly, fmpz_t den, const char * str, slong len);
0125
0126 int fmpq_poly_set_str(fmpq_poly_t poly, const char * str);
0127
0128 char * fmpq_poly_get_str(const fmpq_poly_t poly);
0129
0130 char * fmpq_poly_get_str_pretty(const fmpq_poly_t poly,
0131 const char * var);
0132
0133 char * _fmpq_poly_get_str_pretty(const fmpz *poly,
0134 const fmpz_t den, slong len, const char *var);
0135
0136 void fmpq_poly_zero(fmpq_poly_t poly);
0137 void fmpq_poly_one(fmpq_poly_t poly);
0138
0139 void fmpq_poly_neg(fmpq_poly_t poly1, const fmpq_poly_t poly2);
0140
0141 void fmpq_poly_inv(fmpq_poly_t poly1, const fmpq_poly_t poly2);
0142
0143 void fmpq_poly_swap(fmpq_poly_t poly1, fmpq_poly_t poly2);
0144
0145 void fmpq_poly_truncate(fmpq_poly_t poly, slong n);
0146
0147 void fmpq_poly_set_trunc(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0148
0149 void fmpq_poly_get_slice(fmpq_poly_t rop,
0150 const fmpq_poly_t op, slong i, slong j);
0151
0152 void fmpq_poly_reverse(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0153
0154
0155
0156 void fmpq_poly_get_coeff_fmpz(fmpz_t x, const fmpq_poly_t poly, slong n);
0157
0158 void fmpq_poly_get_coeff_fmpq(fmpq_t x, const fmpq_poly_t poly, slong n);
0159
0160 void fmpq_poly_set_coeff_si(fmpq_poly_t poly, slong n, slong x);
0161
0162 void fmpq_poly_set_coeff_ui(fmpq_poly_t poly, slong n, ulong x);
0163
0164 void fmpq_poly_set_coeff_fmpz(fmpq_poly_t poly, slong n, const fmpz_t x);
0165
0166 void fmpq_poly_set_coeff_fmpq(fmpq_poly_t poly, slong n, const fmpq_t x);
0167
0168
0169
0170 int fmpq_poly_equal(const fmpq_poly_t poly1, const fmpq_poly_t poly2);
0171
0172 int _fmpq_poly_cmp(const fmpz * lpoly, const fmpz_t lden,
0173 const fmpz * rpoly, const fmpz_t rden, slong len);
0174
0175 int fmpq_poly_cmp(const fmpq_poly_t left, const fmpq_poly_t right);
0176
0177 int _fmpq_poly_equal_trunc(const fmpz * poly1, const fmpz_t den1, slong len1,
0178 const fmpz * poly2, const fmpz_t den2, slong len2, slong n);
0179
0180 int fmpq_poly_equal_trunc(const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n);
0181
0182 FMPQ_POLY_INLINE
0183 int fmpq_poly_is_zero(const fmpq_poly_t poly)
0184 {
0185 return poly->length == WORD(0);
0186 }
0187
0188 int fmpq_poly_is_one(const fmpq_poly_t poly);
0189
0190 FMPQ_POLY_INLINE
0191 int fmpq_poly_is_gen(const fmpq_poly_t op)
0192 {
0193 return (op->length) == 2 && (*(op->coeffs + 1) == WORD(1)) && (*(op->coeffs + 0) == WORD(0)) && (*(op->den) == WORD(1));
0194 }
0195
0196
0197
0198 void _fmpq_poly_add(fmpz * rpoly, fmpz_t rden,
0199 const fmpz * poly1, const fmpz_t den1, slong len1,
0200 const fmpz * poly2, const fmpz_t den2, slong len2);
0201
0202 void fmpq_poly_add(fmpq_poly_t res,
0203 const fmpq_poly_t poly1, const fmpq_poly_t poly2);
0204
0205 void _fmpq_poly_add_can(fmpz * rpoly, fmpz_t rden,
0206 const fmpz * poly1, const fmpz_t den1, slong len1,
0207 const fmpz * poly2, const fmpz_t den2, slong len2, int can);
0208
0209 void fmpq_poly_add_can(fmpq_poly_t res,
0210 const fmpq_poly_t poly1, const fmpq_poly_t poly2, int can);
0211
0212 void fmpq_poly_add_si(fmpq_poly_t res, const fmpq_poly_t poly, slong c);
0213 void fmpq_poly_add_fmpz(fmpq_poly_t res, const fmpq_poly_t poly, const fmpz_t c);
0214 void fmpq_poly_add_fmpq(fmpq_poly_t res, const fmpq_poly_t poly, const fmpq_t c);
0215
0216 void _fmpq_poly_add_series(fmpz * rpoly, fmpz_t rden,
0217 const fmpz * poly1, const fmpz_t den1, slong len1,
0218 const fmpz * poly2, const fmpz_t den2, slong len2, slong n);
0219
0220 void fmpq_poly_add_series(fmpq_poly_t res,
0221 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n);
0222
0223 void _fmpq_poly_add_series_can(fmpz * rpoly, fmpz_t rden,
0224 const fmpz * poly1, const fmpz_t den1, slong len1,
0225 const fmpz * poly2, const fmpz_t den2, slong len2, slong n, int can);
0226
0227 void fmpq_poly_add_series_can(fmpq_poly_t res,
0228 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n, int can);
0229
0230 void _fmpq_poly_sub(fmpz * rpoly, fmpz_t rden,
0231 const fmpz * poly1, const fmpz_t den1, slong len1,
0232 const fmpz * poly2, const fmpz_t den2, slong len2);
0233
0234 void fmpq_poly_sub(fmpq_poly_t res,
0235 const fmpq_poly_t poly1, const fmpq_poly_t poly2);
0236
0237 void fmpq_poly_sub_si(fmpq_poly_t res, const fmpq_poly_t poly, slong c);
0238 void fmpq_poly_si_sub(fmpq_poly_t res, slong c, const fmpq_poly_t poly);
0239 void fmpq_poly_sub_fmpz(fmpq_poly_t res, const fmpq_poly_t poly, const fmpz_t c);
0240 void fmpq_poly_fmpz_sub(fmpq_poly_t res, const fmpz_t c, const fmpq_poly_t poly);
0241 void fmpq_poly_sub_fmpq(fmpq_poly_t res, const fmpq_poly_t poly, const fmpq_t c);
0242 void fmpq_poly_fmpq_sub(fmpq_poly_t res, const fmpq_t c, const fmpq_poly_t poly);
0243
0244 void _fmpq_poly_sub_can(fmpz * rpoly, fmpz_t rden,
0245 const fmpz * poly1, const fmpz_t den1, slong len1,
0246 const fmpz * poly2, const fmpz_t den2, slong len2, int can);
0247
0248 void fmpq_poly_sub_can(fmpq_poly_t res,
0249 const fmpq_poly_t poly1, const fmpq_poly_t poly2, int can);
0250
0251 void _fmpq_poly_sub_series(fmpz * rpoly, fmpz_t rden,
0252 const fmpz * poly1, const fmpz_t den1, slong len1,
0253 const fmpz * poly2, const fmpz_t den2, slong len2, slong n);
0254
0255 void fmpq_poly_sub_series(fmpq_poly_t res,
0256 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n);
0257
0258 void _fmpq_poly_sub_series_can(fmpz * rpoly, fmpz_t rden,
0259 const fmpz * poly1, const fmpz_t den1, slong len1,
0260 const fmpz * poly2, const fmpz_t den2, slong len2, slong n, int can);
0261
0262 void fmpq_poly_sub_series_can(fmpq_poly_t res,
0263 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n, int can);
0264
0265
0266
0267 void _fmpq_poly_scalar_mul_si(fmpz * rpoly, fmpz_t rden,
0268 const fmpz * poly, const fmpz_t den, slong len, slong c);
0269
0270 void _fmpq_poly_scalar_mul_ui(fmpz * rpoly, fmpz_t rden,
0271 const fmpz * poly, const fmpz_t den, slong len, ulong c);
0272
0273 void _fmpq_poly_scalar_mul_fmpz(fmpz * rpoly, fmpz_t rden,
0274 const fmpz * poly, const fmpz_t den, slong len, const fmpz_t c);
0275
0276 void _fmpq_poly_scalar_mul_fmpq(fmpz * rpoly, fmpz_t rden, const fmpz * poly,
0277 const fmpz_t den, slong len, const fmpz_t r, const fmpz_t s);
0278
0279 void fmpq_poly_scalar_mul_si(fmpq_poly_t rop, const fmpq_poly_t op, slong c);
0280
0281 void fmpq_poly_scalar_mul_ui(fmpq_poly_t rop, const fmpq_poly_t op, ulong c);
0282
0283 void fmpq_poly_scalar_mul_fmpz(fmpq_poly_t rop,
0284 const fmpq_poly_t op, const fmpz_t c);
0285
0286 void fmpq_poly_scalar_mul_fmpq(fmpq_poly_t rop,
0287 const fmpq_poly_t op, const fmpq_t c);
0288
0289 void _fmpq_poly_scalar_div_si(fmpz * rpoly, fmpz_t rden,
0290 const fmpz * poly, const fmpz_t den, slong len, slong c);
0291
0292 void _fmpq_poly_scalar_div_ui(fmpz * rpoly, fmpz_t rden,
0293 const fmpz * poly, const fmpz_t den, slong len, ulong c);
0294
0295 void _fmpq_poly_scalar_div_fmpz(fmpz * rpoly, fmpz_t rden,
0296 const fmpz * poly, const fmpz_t den, slong len, const fmpz_t c);
0297
0298 void _fmpq_poly_scalar_div_fmpq(fmpz * rpoly, fmpz_t rden, const fmpz * poly,
0299 const fmpz_t den, slong len, const fmpz_t r, const fmpz_t s);
0300
0301 void fmpq_poly_scalar_div_si(fmpq_poly_t rop, const fmpq_poly_t op, slong c);
0302
0303 void fmpq_poly_scalar_div_ui(fmpq_poly_t rop, const fmpq_poly_t op, ulong c);
0304
0305 void fmpq_poly_scalar_div_fmpz(fmpq_poly_t rop,
0306 const fmpq_poly_t op, const fmpz_t c);
0307
0308 void fmpq_poly_scalar_div_fmpq(fmpq_poly_t rop,
0309 const fmpq_poly_t op, const fmpq_t c);
0310
0311
0312
0313 void _fmpq_poly_mul(fmpz * rpoly, fmpz_t rden,
0314 const fmpz * poly1, const fmpz_t den1, slong len1,
0315 const fmpz * poly2, const fmpz_t den2, slong len2);
0316
0317 void fmpq_poly_mul(fmpq_poly_t res,
0318 const fmpq_poly_t poly1, const fmpq_poly_t poly2);
0319
0320 void _fmpq_poly_mullow(fmpz * rpoly, fmpz_t rden,
0321 const fmpz * poly1, const fmpz_t den1, slong len1,
0322 const fmpz * poly2, const fmpz_t den2, slong len2, slong n);
0323
0324 void fmpq_poly_mullow(fmpq_poly_t res,
0325 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n);
0326
0327 FMPQ_POLY_INLINE
0328 void fmpq_poly_addmul(fmpq_poly_t rop, const fmpq_poly_t op1, const fmpq_poly_t op2)
0329 {
0330 fmpq_poly_t t;
0331
0332 fmpq_poly_init(t);
0333 fmpq_poly_mul(t, op1, op2);
0334 fmpq_poly_add(rop, rop, t);
0335 fmpq_poly_clear(t);
0336 }
0337
0338 FMPQ_POLY_INLINE
0339 void fmpq_poly_submul(fmpq_poly_t rop, const fmpq_poly_t op1, const fmpq_poly_t op2)
0340 {
0341 fmpq_poly_t t;
0342
0343 fmpq_poly_init(t);
0344 fmpq_poly_mul(t, op1, op2);
0345 fmpq_poly_sub(rop, rop, t);
0346 fmpq_poly_clear(t);
0347 }
0348
0349
0350
0351 void _fmpq_poly_pow(fmpz * rpoly, fmpz_t rden, const fmpz * poly,
0352 const fmpz_t den, slong len, ulong e);
0353
0354 void fmpq_poly_pow(fmpq_poly_t rpoly, const fmpq_poly_t poly, ulong e);
0355
0356 void _fmpq_poly_pow_trunc(fmpz * res, fmpz_t resden,
0357 const fmpz * f, const fmpz_t fden, slong flen, ulong exp, slong len);
0358
0359 void fmpq_poly_pow_trunc(fmpq_poly_t res,
0360 const fmpq_poly_t poly, ulong exp, slong len);
0361
0362
0363
0364 void fmpq_poly_shift_left(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0365
0366 void fmpq_poly_shift_right(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0367
0368
0369
0370 #ifdef FMPZ_H
0371 void _fmpq_poly_divrem(fmpz * Q, fmpz_t q, fmpz * R, fmpz_t r, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t b, slong lenB, const fmpz_preinvn_t inv);
0372 void _fmpq_poly_div(fmpz * Q, fmpz_t q, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t b, slong lenB, const fmpz_preinvn_t inv);
0373 void _fmpq_poly_rem(fmpz * R, fmpz_t r, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t FLINT_UNUSED(b), slong lenB, const fmpz_preinvn_t inv);
0374 #endif
0375
0376 void fmpq_poly_divrem(fmpq_poly_t Q, fmpq_poly_t R, const fmpq_poly_t poly1, const fmpq_poly_t poly2);
0377 void fmpq_poly_div(fmpq_poly_t Q, const fmpq_poly_t poly1, const fmpq_poly_t poly2);
0378 void fmpq_poly_rem(fmpq_poly_t R, const fmpq_poly_t poly1, const fmpq_poly_t poly2);
0379
0380
0381
0382 fmpq_poly_struct * _fmpq_poly_powers_precompute(const fmpz * B, const fmpz_t FLINT_UNUSED(denB), slong len);
0383 void fmpq_poly_powers_precompute(fmpq_poly_powers_precomp_t pinv, fmpq_poly_t poly);
0384
0385 void _fmpq_poly_powers_clear(fmpq_poly_struct * powers, slong len);
0386
0387 void fmpq_poly_powers_clear(fmpq_poly_powers_precomp_t pinv);
0388
0389 void _fmpq_poly_rem_powers_precomp(fmpz * A, fmpz_t denA, slong m,
0390 const fmpz * B, const fmpz_t denB, slong n,
0391 fmpq_poly_struct * const powers);
0392
0393 void fmpq_poly_rem_powers_precomp(fmpq_poly_t R, const fmpq_poly_t A,
0394 const fmpq_poly_t B, const fmpq_poly_powers_precomp_t B_inv);
0395
0396
0397
0398 int _fmpq_poly_divides(fmpz * qpoly, fmpz_t qden,
0399 const fmpz * poly1, const fmpz_t den1, slong len1,
0400 const fmpz * poly2, const fmpz_t den2, slong len2);
0401
0402 int fmpq_poly_divides(fmpq_poly_t q, const fmpq_poly_t poly1,
0403 const fmpq_poly_t poly2);
0404
0405 slong fmpq_poly_remove(fmpq_poly_t q, const fmpq_poly_t poly1,
0406 const fmpq_poly_t poly2);
0407
0408
0409
0410 void _fmpq_poly_inv_series_newton(fmpz * Qinv, fmpz_t Qinvden,
0411 const fmpz * Q, const fmpz_t Qden, slong Qlen, slong n);
0412
0413 void fmpq_poly_inv_series_newton(fmpq_poly_t Qinv, const fmpq_poly_t Q, slong n);
0414
0415 FMPQ_POLY_INLINE void
0416 _fmpq_poly_inv_series(fmpz * Qinv, fmpz_t Qinvden,
0417 const fmpz * Q, const fmpz_t Qden, slong Qlen, slong n)
0418 {
0419 _fmpq_poly_inv_series_newton(Qinv, Qinvden, Q, Qden, Qlen, n);
0420 }
0421
0422 FMPQ_POLY_INLINE void
0423 fmpq_poly_inv_series(fmpq_poly_t Qinv, const fmpq_poly_t Q, slong n)
0424 {
0425 fmpq_poly_inv_series_newton(Qinv, Q, n);
0426 }
0427
0428 void _fmpq_poly_div_series(fmpz * Q, fmpz_t denQ,
0429 const fmpz * A, const fmpz_t denA, slong lenA,
0430 const fmpz * B, const fmpz_t denB, slong lenB, slong n);
0431
0432 void fmpq_poly_div_series(fmpq_poly_t Q, const fmpq_poly_t A,
0433 const fmpq_poly_t B, slong n);
0434
0435
0436
0437 void _fmpq_poly_gcd(fmpz *G, fmpz_t denG,
0438 const fmpz *A, slong lenA, const fmpz *B, slong lenB);
0439
0440 void fmpq_poly_gcd(fmpq_poly_t G, const fmpq_poly_t A, const fmpq_poly_t B);
0441
0442 void _fmpq_poly_xgcd(fmpz *G, fmpz_t denG,
0443 fmpz *S, fmpz_t denS, fmpz *T, fmpz_t denT,
0444 const fmpz *A, const fmpz_t denA, slong lenA,
0445 const fmpz *B, const fmpz_t denB, slong lenB);
0446
0447 void fmpq_poly_xgcd(fmpq_poly_t G, fmpq_poly_t S, fmpq_poly_t T,
0448 const fmpq_poly_t A, const fmpq_poly_t B);
0449
0450 void _fmpq_poly_lcm(fmpz *G, fmpz_t denG,
0451 const fmpz *A, slong lenA, const fmpz *B, slong lenB);
0452
0453 void fmpq_poly_lcm(fmpq_poly_t L, const fmpq_poly_t A, const fmpq_poly_t B);
0454
0455 void _fmpq_poly_resultant(fmpz_t rnum, fmpz_t rden,
0456 const fmpz *poly1, const fmpz_t den1, slong len1,
0457 const fmpz *poly2, const fmpz_t den2, slong len2);
0458
0459 void fmpq_poly_resultant(fmpq_t r, const fmpq_poly_t f, const fmpq_poly_t g);
0460
0461
0462 void _fmpq_poly_resultant_div(fmpz_t rnum, fmpz_t rden,
0463 const fmpz *poly1, const fmpz_t den1, slong len1,
0464 const fmpz *poly2, const fmpz_t den2, slong len2,
0465 const fmpz_t divisor, slong nbits);
0466
0467 void fmpq_poly_resultant_div(fmpq_t r, const fmpq_poly_t f, const fmpq_poly_t g, const fmpz_t divisor, slong nbits);
0468
0469
0470
0471 void _fmpq_poly_derivative(fmpz * rpoly, fmpz_t rden,
0472 const fmpz * poly, const fmpz_t den, slong len);
0473
0474 void fmpq_poly_derivative(fmpq_poly_t res, const fmpq_poly_t poly);
0475
0476 void _fmpq_poly_nth_derivative(fmpz * rpoly, fmpz_t rden,
0477 const fmpz * poly, const fmpz_t den, ulong n, slong len);
0478
0479 void fmpq_poly_nth_derivative(fmpq_poly_t res, const fmpq_poly_t poly, ulong n);
0480
0481 void _fmpq_poly_integral(fmpz * rpoly, fmpz_t rden,
0482 const fmpz * poly, const fmpz_t den, slong len);
0483
0484 void fmpq_poly_integral(fmpq_poly_t res, const fmpq_poly_t poly);
0485
0486 void _fmpq_poly_integral_offset(fmpz * rpoly, fmpz_t rden,
0487 const fmpz * poly, const fmpz_t den, slong len, slong m);
0488
0489
0490
0491 void _fmpq_poly_invsqrt_series(fmpz * rpoly, fmpz_t rden,
0492 const fmpz * poly, const fmpz_t den, slong len, slong n);
0493
0494 void fmpq_poly_invsqrt_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0495
0496 void _fmpq_poly_sqrt_series(fmpz * rpoly, fmpz_t rden,
0497 const fmpz * poly, const fmpz_t den, slong len, slong n);
0498
0499 void fmpq_poly_sqrt_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0500
0501
0502
0503 void _fmpq_poly_power_sums(fmpz * res, fmpz_t rden, const fmpz * poly, slong len, slong n);
0504
0505 void fmpq_poly_power_sums(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0506
0507 void _fmpq_poly_power_sums_to_poly(fmpz * res, const fmpz * poly, const fmpz_t den, slong len);
0508
0509 void fmpq_poly_power_sums_to_fmpz_poly(fmpz_poly_t res, const fmpq_poly_t Q);
0510
0511 void fmpq_poly_power_sums_to_poly(fmpq_poly_t res, const fmpq_poly_t Q);
0512
0513
0514
0515 void _fmpq_poly_log_series(fmpz * g, fmpz_t gden,
0516 const fmpz * f, const fmpz_t fden, slong flen, slong n);
0517
0518 void fmpq_poly_log_series(fmpq_poly_t res, const fmpq_poly_t f, slong n);
0519
0520 void _fmpq_poly_exp_series(fmpz * g, fmpz_t gden,
0521 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0522
0523 void fmpq_poly_exp_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0524
0525 void _fmpq_poly_exp_expinv_series(fmpz * g, fmpz_t gden, fmpz * r, fmpz_t rden,
0526 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0527
0528 void fmpq_poly_exp_expinv_series(fmpq_poly_t res1, fmpq_poly_t res2, const fmpq_poly_t poly, slong n);
0529
0530 void _fmpq_poly_atan_series(fmpz * g, fmpz_t gden,
0531 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0532
0533 void fmpq_poly_atan_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0534
0535 void _fmpq_poly_atanh_series(fmpz * g, fmpz_t gden,
0536 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0537
0538 void fmpq_poly_atanh_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0539
0540 void _fmpq_poly_asin_series(fmpz * g, fmpz_t gden,
0541 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0542
0543 void fmpq_poly_asin_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0544
0545 void _fmpq_poly_asinh_series(fmpz * g, fmpz_t gden,
0546 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0547
0548 void fmpq_poly_asinh_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0549
0550 void _fmpq_poly_tan_series(fmpz * g, fmpz_t gden,
0551 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0552
0553 void fmpq_poly_tan_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0554
0555 void _fmpq_poly_sin_series(fmpz * g, fmpz_t gden,
0556 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0557
0558 void fmpq_poly_sin_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0559
0560 void _fmpq_poly_cos_series(fmpz * g, fmpz_t gden,
0561 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0562
0563 void fmpq_poly_cos_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0564
0565 void _fmpq_poly_sin_cos_series_basecase(fmpz * S, fmpz_t Sden,
0566 fmpz * C, fmpz_t Cden, const fmpz * A, const fmpz_t Aden, slong Alen, slong n);
0567
0568 void _fmpq_poly_sin_cos_series_newton(
0569 fmpz * S, fmpz_t Sden,
0570 fmpz * C, fmpz_t Cden,
0571 const fmpz * h, const fmpz_t hden, slong hlen, slong cutoff, slong n);
0572
0573 void _fmpq_poly_sin_cos_series(fmpz * s, fmpz_t sden, fmpz * c, fmpz_t cden,
0574 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0575
0576 void fmpq_poly_sin_cos_series(fmpq_poly_t res1, fmpq_poly_t res2,
0577 const fmpq_poly_t poly, slong n);
0578
0579 void _fmpq_poly_sinh_series(fmpz * g, fmpz_t gden,
0580 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0581
0582 void fmpq_poly_sinh_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0583
0584 void _fmpq_poly_cosh_series(fmpz * g, fmpz_t gden,
0585 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0586
0587 void fmpq_poly_cosh_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0588
0589 void _fmpq_poly_sinh_cosh_series(fmpz * s, fmpz_t sden, fmpz * c, fmpz_t cden,
0590 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0591
0592 void fmpq_poly_sinh_cosh_series(fmpq_poly_t res1, fmpq_poly_t res2,
0593 const fmpq_poly_t poly, slong n);
0594
0595 void _fmpq_poly_tanh_series(fmpz * g, fmpz_t gden,
0596 const fmpz * h, const fmpz_t hden, slong hlen, slong n);
0597
0598 void fmpq_poly_tanh_series(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
0599
0600
0601
0602 void _fmpq_poly_legendre_p(fmpz * coeffs, fmpz_t den, ulong n);
0603
0604 void fmpq_poly_legendre_p(fmpq_poly_t poly, ulong n);
0605
0606 void _fmpq_poly_laguerre_l(fmpz * coeffs, fmpz_t den, ulong n);
0607
0608 void fmpq_poly_laguerre_l(fmpq_poly_t poly, ulong n);
0609
0610 void _fmpq_poly_gegenbauer_c(fmpz * coeffs, fmpz_t den, ulong n, const fmpq_t a);
0611
0612 void fmpq_poly_gegenbauer_c(fmpq_poly_t poly, ulong n, const fmpq_t a);
0613
0614
0615
0616 void _fmpq_poly_evaluate_fmpz(fmpz_t rnum, fmpz_t rden, const fmpz * poly,
0617 const fmpz_t den, slong len, const fmpz_t a);
0618
0619 void fmpq_poly_evaluate_fmpz(fmpq_t res, const fmpq_poly_t poly,
0620 const fmpz_t a);
0621
0622 void _fmpq_poly_evaluate_fmpq(fmpz_t rnum, fmpz_t rden,
0623 const fmpz * poly, const fmpz_t den, slong len,
0624 const fmpz_t anum, const fmpz_t aden);
0625
0626 void fmpq_poly_evaluate_fmpq(fmpq_t res, const fmpq_poly_t poly, const fmpq_t a);
0627
0628
0629
0630 int _fmpq_poly_interpolate_fmpq_vec(fmpz *coeffs, fmpz_t den,
0631 const fmpq *xs, const fmpq *ys, slong n);
0632
0633 int fmpq_poly_interpolate_fmpq_vec(fmpq_poly_t poly,
0634 const fmpq * xs, const fmpq * ys, slong n);
0635
0636 int fmpq_poly_interpolate_fmpz_fmpq_vec(fmpq_poly_t poly,
0637 const fmpz * xs, const fmpq * ys, slong n);
0638
0639 int fmpq_poly_interpolate_fmpz_vec(fmpq_poly_t poly,
0640 const fmpz * xs, const fmpz * ys, slong n);
0641
0642 void _fmpq_poly_interpolation_weights(fmpz * w, fmpz_t wden,
0643 const fmpq * xs, slong len);
0644
0645 void _fmpq_poly_interpolate_fast_precomp(fmpz * poly, fmpz_t den,
0646 const fmpq * ys, fmpz * const * tree, const fmpz * weights, slong len);
0647
0648 void _fmpq_poly_interpolate_fast(fmpz * poly, fmpz_t den,
0649 const fmpq * xs, const fmpq * ys, slong len);
0650
0651 void fmpq_poly_interpolate_fast(fmpq_poly_t poly,
0652 const fmpq * xs, const fmpq * ys, slong n);
0653
0654 void _fmpq_poly_interpolate_multi_mod(fmpz * poly, fmpz_t den,
0655 const fmpq * xs, const fmpq * ys, slong n);
0656
0657 void fmpq_poly_interpolate_multi_mod(fmpq_poly_t poly,
0658 const fmpq * xs, const fmpq * ys, slong n);
0659
0660 void _fmpq_poly_interpolate_barycentric(fmpz * poly, fmpz_t den,
0661 const fmpq * xs, const fmpq * ys, slong n);
0662
0663 void fmpq_poly_interpolate_barycentric(fmpq_poly_t poly,
0664 const fmpq * xs, const fmpq * ys, slong n);
0665
0666
0667
0668 void _fmpq_poly_compose(fmpz * res, fmpz_t den,
0669 const fmpz * poly1, const fmpz_t den1, slong len1,
0670 const fmpz * poly2, const fmpz_t den2, slong len2);
0671
0672 void fmpq_poly_compose(fmpq_poly_t res,
0673 const fmpq_poly_t poly1, const fmpq_poly_t poly2);
0674
0675 void _fmpq_poly_rescale(fmpz * res, fmpz_t denr, const fmpz * poly,
0676 const fmpz_t den, slong len, const fmpz_t xnum, const fmpz_t xden);
0677
0678 void fmpq_poly_rescale(fmpq_poly_t res,
0679 const fmpq_poly_t poly, const fmpq_t x);
0680
0681
0682
0683 void _fmpq_poly_compose_series_horner(fmpz * res, fmpz_t den, const fmpz * poly1,
0684 const fmpz_t den1, slong len1, const fmpz * poly2,
0685 const fmpz_t den2, slong len2, slong n);
0686
0687 void fmpq_poly_compose_series_horner(fmpq_poly_t res,
0688 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n);
0689
0690 void _fmpq_poly_compose_series_brent_kung(fmpz * res, fmpz_t den,
0691 const fmpz * poly1, const fmpz_t den1, slong len1,
0692 const fmpz * poly2, const fmpz_t den2, slong len2, slong n);
0693
0694 void fmpq_poly_compose_series_brent_kung(fmpq_poly_t res,
0695 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n);
0696
0697 void _fmpq_poly_compose_series_kinoshita_li(fmpz * res, fmpz_t den,
0698 const fmpz * poly1, const fmpz_t den1, slong len1,
0699 const fmpz * poly2, const fmpz_t den2, slong len2, slong n);
0700
0701 void fmpq_poly_compose_series_kinoshita_li(fmpq_poly_t res,
0702 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n);
0703
0704 void _fmpq_poly_compose_series(fmpz * res, fmpz_t den,
0705 const fmpz * poly1, const fmpz_t den1, slong len1,
0706 const fmpz * poly2, const fmpz_t den2, slong len2, slong n);
0707
0708 void fmpq_poly_compose_series(fmpq_poly_t res,
0709 const fmpq_poly_t poly1, const fmpq_poly_t poly2, slong n);
0710
0711
0712
0713 void _fmpq_poly_revert_series_lagrange(fmpz * res, fmpz_t den,
0714 const fmpz * poly1, const fmpz_t den1, slong len1, slong n);
0715
0716 void fmpq_poly_revert_series_lagrange(fmpq_poly_t res,
0717 const fmpq_poly_t poly, slong n);
0718
0719 void _fmpq_poly_revert_series_lagrange_fast(fmpz * res, fmpz_t den,
0720 const fmpz * poly1, const fmpz_t den1, slong len1, slong n);
0721
0722 void fmpq_poly_revert_series_lagrange_fast(fmpq_poly_t res,
0723 const fmpq_poly_t poly, slong n);
0724
0725 void _fmpq_poly_revert_series_newton(fmpz * res, fmpz_t den,
0726 const fmpz * poly1, const fmpz_t den1, slong len1, slong n);
0727
0728 void fmpq_poly_revert_series_newton(fmpq_poly_t res,
0729 const fmpq_poly_t poly, slong n);
0730
0731 void _fmpq_poly_revert_series(fmpz * res, fmpz_t den,
0732 const fmpz * poly1, const fmpz_t den1, slong len1, slong n);
0733
0734 void fmpq_poly_revert_series(fmpq_poly_t res,
0735 const fmpq_poly_t poly, slong n);
0736
0737
0738
0739 void _fmpq_poly_content(fmpq_t res,
0740 const fmpz * poly, const fmpz_t den, slong len);
0741
0742 void fmpq_poly_content(fmpq_t res, const fmpq_poly_t poly);
0743
0744 void _fmpq_poly_primitive_part(fmpz * rpoly, fmpz_t rden,
0745 const fmpz * poly, const fmpz_t FLINT_UNUSED(den), slong len);
0746
0747 void fmpq_poly_primitive_part(fmpq_poly_t res, const fmpq_poly_t poly);
0748
0749 int _fmpq_poly_is_monic(const fmpz * poly, const fmpz_t den, slong len);
0750
0751 int fmpq_poly_is_monic(const fmpq_poly_t poly);
0752
0753 void _fmpq_poly_make_monic(fmpz * rpoly, fmpz_t rden,
0754 const fmpz * poly, const fmpz_t FLINT_UNUSED(den), slong len);
0755
0756 void fmpq_poly_make_monic(fmpq_poly_t res, const fmpq_poly_t poly);
0757
0758
0759
0760 int fmpq_poly_is_squarefree(const fmpq_poly_t poly);
0761
0762
0763 void _fmpq_poly_discriminant(fmpq_t res, const fmpz* poly, const fmpz_t den, slong len);
0764 void fmpq_poly_discriminant(fmpq_t res, const fmpq_poly_t poly);
0765
0766
0767
0768 #ifdef FLINT_HAVE_FILE
0769 int _fmpq_poly_fprint(FILE * file, const fmpz * poly, const fmpz_t den, slong len);
0770 int fmpq_poly_fprint(FILE * file, const fmpq_poly_t poly);
0771 int _fmpq_poly_fprint_pretty(FILE * file, const fmpz * poly, const fmpz_t den, slong len, const char * x);
0772 int fmpq_poly_fprint_pretty(FILE * file, const fmpq_poly_t poly, const char * var);
0773
0774 int fmpq_poly_fread(FILE * file, fmpq_poly_t poly);
0775 #endif
0776
0777 int _fmpq_poly_print(const fmpz * poly, const fmpz_t den, slong len);
0778 int fmpq_poly_print(const fmpq_poly_t poly);
0779 int _fmpq_poly_print_pretty(const fmpz *poly, const fmpz_t den, slong len, const char * x);
0780 int fmpq_poly_print_pretty(const fmpq_poly_t poly, const char * var);
0781
0782 int fmpq_poly_read(fmpq_poly_t poly);
0783
0784 int fmpq_poly_debug(const fmpq_poly_t poly);
0785
0786
0787
0788 #define fmpq_poly_set_mpz _Pragma("GCC error \"'fmpq_poly_set_mpz' is deprecated. Use 'fmpq_poly_set_fmpz' instead.\"")
0789 #define fmpq_poly_set_mpq _Pragma("GCC error \"'fmpq_poly_set_mpq' is deprecated. Use 'fmpq_poly_set_fmpq' instead.\"")
0790 #define _fmpq_poly_set_array_mpq _Pragma("GCC error \"'_fmpq_poly_set_array_mpq' is deprecated. Use 'fmpq_poly_set' instead.\"")
0791 #define fmpq_poly_set_array_mpq _Pragma("GCC error \"'fmpq_poly_set_array_mpq' is deprecated. Use 'fmpq_poly_set' instead.\"")
0792 #define fmpq_poly_get_coeff_mpq _Pragma("GCC error \"'fmpq_poly_get_coeff_mpq' is deprecated. Use 'fmpq_poly_get_coeff_fmpq' instead.\"")
0793 #define fmpq_poly_set_coeff_mpz _Pragma("GCC error \"'fmpq_poly_set_coeff_mpz' is deprecated. Use 'fmpq_poly_set_coeff_fmpz' instead.\"")
0794 #define fmpq_poly_set_coeff_mpq _Pragma("GCC error \"'fmpq_poly_set_coeff_mpq' is deprecated. Use 'fmpq_poly_set_coeff_fmpq' instead.\"")
0795 #define fmpq_poly_scalar_mul_mpz _Pragma("GCC error \"'fmpq_poly_scalar_mul_mpz' is deprecated. Use 'fmpq_poly_scalar_mul_fmpz' instead.\"")
0796 #define fmpq_poly_scalar_mul_mpq _Pragma("GCC error \"'fmpq_poly_scalar_mul_mpq' is deprecated. Use 'fmpq_poly_scalar_mul_fmpq' instead.\"")
0797 #define fmpq_poly_scalar_div_mpz _Pragma("GCC error \"'fmpq_poly_scalar_div_mpz' is deprecated. Use 'fmpq_poly_scalar_div_fmpz' instead.\"")
0798 #define fmpq_poly_scalar_div_mpq _Pragma("GCC error \"'fmpq_poly_scalar_div_mpq' is deprecated. Use 'fmpq_poly_scalar_div_fmpq' instead.\"")
0799 #define fmpq_poly_evaluate_mpz _Pragma("GCC error \"'fmpq_poly_evaluate_mpz' is deprecated. Use 'fmpq_poly_evaluate_fmpz' instead.\"")
0800 #define fmpq_poly_evaluate_mpq _Pragma("GCC error \"'fmpq_poly_evaluate_mpq' is deprecated. Use 'fmpq_poly_evaluate_fmpq' instead.\"")
0801
0802 #ifdef __cplusplus
0803 }
0804 #endif
0805
0806 #endif