File indexing completed on 2026-11-07 10:15:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ACB_H
0013 #define ACB_H
0014
0015 #ifdef ACB_INLINES_C
0016 #define ACB_INLINE
0017 #else
0018 #define ACB_INLINE static inline
0019 #endif
0020
0021 #include "arb.h"
0022 #include "acb_types.h"
0023
0024 #ifdef __cplusplus
0025 extern "C" {
0026 #endif
0027
0028 #define acb_realref(x) (&(x)->real)
0029 #define acb_imagref(x) (&(x)->imag)
0030
0031 ACB_INLINE void
0032 acb_init(acb_t x)
0033 {
0034 arb_init(acb_realref(x));
0035 arb_init(acb_imagref(x));
0036 }
0037
0038 void acb_clear(acb_t x);
0039
0040 acb_ptr _acb_vec_init(slong n);
0041 void _acb_vec_clear(acb_ptr v, slong n);
0042
0043 ACB_INLINE arb_ptr acb_real_ptr(acb_t z) { return acb_realref(z); }
0044 ACB_INLINE arb_ptr acb_imag_ptr(acb_t z) { return acb_imagref(z); }
0045
0046 ACB_INLINE void
0047 acb_get_real(arb_t re, const acb_t z)
0048 {
0049 arb_set(re, acb_realref(z));
0050 }
0051
0052 ACB_INLINE void
0053 acb_get_imag(arb_t im, const acb_t z)
0054 {
0055 arb_set(im, acb_imagref(z));
0056 }
0057
0058 ACB_INLINE void
0059 acb_get_mid(acb_t res, const acb_t x)
0060 {
0061 arb_get_mid_arb(acb_realref(res), acb_realref(x));
0062 arb_get_mid_arb(acb_imagref(res), acb_imagref(x));
0063 }
0064
0065 ACB_INLINE int
0066 acb_is_zero(const acb_t z)
0067 {
0068 return arb_is_zero(acb_realref(z)) && arb_is_zero(acb_imagref(z));
0069 }
0070
0071 ACB_INLINE int
0072 acb_is_one(const acb_t z)
0073 {
0074 return arb_is_one(acb_realref(z)) && arb_is_zero(acb_imagref(z));
0075 }
0076
0077 ACB_INLINE int
0078 acb_is_exact(const acb_t z)
0079 {
0080 return arb_is_exact(acb_realref(z)) && arb_is_exact(acb_imagref(z));
0081 }
0082
0083 ACB_INLINE int
0084 acb_is_int(const acb_t z)
0085 {
0086 return arb_is_zero(acb_imagref(z)) && arb_is_int(acb_realref(z));
0087 }
0088
0089 ACB_INLINE int
0090 acb_is_int_2exp_si(const acb_t z, slong e)
0091 {
0092 return arb_is_zero(acb_imagref(z)) && arb_is_int_2exp_si(acb_realref(z), e);
0093 }
0094
0095 ACB_INLINE void
0096 acb_zero(acb_t z)
0097 {
0098 arb_zero(acb_realref(z));
0099 arb_zero(acb_imagref(z));
0100 }
0101
0102 ACB_INLINE void
0103 acb_one(acb_t z)
0104 {
0105 arb_one(acb_realref(z));
0106 arb_zero(acb_imagref(z));
0107 }
0108
0109 ACB_INLINE void
0110 acb_onei(acb_t z)
0111 {
0112 arb_zero(acb_realref(z));
0113 arb_one(acb_imagref(z));
0114 }
0115
0116 ACB_INLINE void
0117 acb_set(acb_t z, const acb_t x)
0118 {
0119 arb_set(acb_realref(z), acb_realref(x));
0120 arb_set(acb_imagref(z), acb_imagref(x));
0121 }
0122
0123 ACB_INLINE void
0124 acb_set_round(acb_t z, const acb_t x, slong prec)
0125 {
0126 arb_set_round(acb_realref(z), acb_realref(x), prec);
0127 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0128 }
0129
0130 ACB_INLINE void
0131 acb_neg_round(acb_t z, const acb_t x, slong prec)
0132 {
0133 arb_neg_round(acb_realref(z), acb_realref(x), prec);
0134 arb_neg_round(acb_imagref(z), acb_imagref(x), prec);
0135 }
0136
0137 ACB_INLINE void
0138 acb_swap(acb_t z, acb_t x)
0139 {
0140 arb_swap(acb_realref(z), acb_realref(x));
0141 arb_swap(acb_imagref(z), acb_imagref(x));
0142 }
0143
0144 ACB_INLINE int
0145 acb_equal(const acb_t x, const acb_t y)
0146 {
0147 return arb_equal(acb_realref(x), acb_realref(y)) &&
0148 arb_equal(acb_imagref(x), acb_imagref(y));
0149 }
0150
0151 ACB_INLINE int
0152 acb_equal_si(const acb_t x, slong y)
0153 {
0154 return arb_equal_si(acb_realref(x), y) && arb_is_zero(acb_imagref(x));
0155 }
0156
0157 ACB_INLINE int
0158 acb_eq(const acb_t x, const acb_t y)
0159 {
0160 return arb_eq(acb_realref(x), acb_realref(y)) &&
0161 arb_eq(acb_imagref(x), acb_imagref(y));
0162 }
0163
0164 ACB_INLINE int
0165 acb_ne(const acb_t x, const acb_t y)
0166 {
0167 return arb_ne(acb_realref(x), acb_realref(y)) ||
0168 arb_ne(acb_imagref(x), acb_imagref(y));
0169 }
0170
0171 ACB_INLINE int
0172 acb_overlaps(const acb_t x, const acb_t y)
0173 {
0174 return arb_overlaps(acb_realref(x), acb_realref(y)) &&
0175 arb_overlaps(acb_imagref(x), acb_imagref(y));
0176 }
0177
0178 ACB_INLINE int
0179 acb_contains_zero(const acb_t x)
0180 {
0181 return arb_contains_zero(acb_realref(x)) &&
0182 arb_contains_zero(acb_imagref(x));
0183 }
0184
0185 ACB_INLINE int
0186 acb_contains_fmpq(const acb_t x, const fmpq_t y)
0187 {
0188 return arb_contains_fmpq(acb_realref(x), y) &&
0189 arb_contains_zero(acb_imagref(x));
0190 }
0191
0192 ACB_INLINE int
0193 acb_contains_fmpz(const acb_t x, const fmpz_t y)
0194 {
0195 return arb_contains_fmpz(acb_realref(x), y) &&
0196 arb_contains_zero(acb_imagref(x));
0197 }
0198
0199 ACB_INLINE int
0200 acb_contains(const acb_t x, const acb_t y)
0201 {
0202 return arb_contains(acb_realref(x), acb_realref(y)) &&
0203 arb_contains(acb_imagref(x), acb_imagref(y));
0204 }
0205
0206 ACB_INLINE int
0207 acb_contains_interior(const acb_t x, const acb_t y)
0208 {
0209 return arb_contains_interior(acb_realref(x), acb_realref(y)) &&
0210 arb_contains_interior(acb_imagref(x), acb_imagref(y));
0211 }
0212
0213 ACB_INLINE void
0214 acb_set_ui(acb_t z, ulong c)
0215 {
0216 arb_set_ui(acb_realref(z), c);
0217 arb_zero(acb_imagref(z));
0218 }
0219
0220 ACB_INLINE void
0221 acb_set_d(acb_t z, double c)
0222 {
0223 arb_set_d(acb_realref(z), c);
0224 arb_zero(acb_imagref(z));
0225 }
0226
0227 ACB_INLINE void
0228 acb_set_si(acb_t z, slong c)
0229 {
0230 arb_set_si(acb_realref(z), c);
0231 arb_zero(acb_imagref(z));
0232 }
0233
0234 ACB_INLINE void
0235 acb_set_si_si(acb_t z, slong x, slong y)
0236 {
0237 arb_set_si(acb_realref(z), x);
0238 arb_set_si(acb_imagref(z), y);
0239 }
0240
0241 ACB_INLINE void
0242 acb_set_d_d(acb_t z, double x, double y)
0243 {
0244 arb_set_d(acb_realref(z), x);
0245 arb_set_d(acb_imagref(z), y);
0246 }
0247
0248 ACB_INLINE void
0249 acb_set_fmpz(acb_t z, const fmpz_t c)
0250 {
0251 arb_set_fmpz(acb_realref(z), c);
0252 arb_zero(acb_imagref(z));
0253 }
0254
0255 ACB_INLINE void
0256 acb_set_fmpz_fmpz(acb_t z, const fmpz_t x, const fmpz_t y)
0257 {
0258 arb_set_fmpz(acb_realref(z), x);
0259 arb_set_fmpz(acb_imagref(z), y);
0260 }
0261
0262 ACB_INLINE void
0263 acb_set_round_fmpz(acb_t z, const fmpz_t y, slong prec)
0264 {
0265 arb_set_round_fmpz(acb_realref(z), y, prec);
0266 arb_zero(acb_imagref(z));
0267 }
0268
0269 int acb_contains_int(const acb_t x);
0270
0271 int acb_get_unique_fmpz(fmpz_t z, const acb_t x);
0272
0273 ACB_INLINE void
0274 acb_set_fmpq(acb_t z, const fmpq_t c, slong prec)
0275 {
0276 arb_set_fmpq(acb_realref(z), c, prec);
0277 arb_zero(acb_imagref(z));
0278 }
0279
0280 ACB_INLINE void
0281 acb_set_arb(acb_t z, const arb_t c)
0282 {
0283 arb_set(acb_realref(z), c);
0284 arb_zero(acb_imagref(z));
0285 }
0286
0287 ACB_INLINE void
0288 acb_set_arb_arb(acb_t z, const arb_t x, const arb_t y)
0289 {
0290 arb_set(acb_realref(z), x);
0291 arb_set(acb_imagref(z), y);
0292 }
0293
0294 ACB_INLINE void
0295 acb_set_round_arb(acb_t z, const arb_t x, slong prec)
0296 {
0297 arb_set_round(acb_realref(z), x, prec);
0298 arb_zero(acb_imagref(z));
0299 }
0300
0301 ACB_INLINE void
0302 acb_trim(acb_t z, const acb_t x)
0303 {
0304 arb_trim(acb_realref(z), acb_realref(x));
0305 arb_trim(acb_imagref(z), acb_imagref(x));
0306 }
0307
0308 ACB_INLINE void
0309 acb_add_error_arf(acb_t x, const arf_t err)
0310 {
0311 arb_add_error_arf(acb_realref(x), err);
0312 arb_add_error_arf(acb_imagref(x), err);
0313 }
0314
0315 ACB_INLINE void
0316 acb_add_error_mag(acb_t x, const mag_t err)
0317 {
0318 arb_add_error_mag(acb_realref(x), err);
0319 arb_add_error_mag(acb_imagref(x), err);
0320 }
0321
0322 ACB_INLINE void
0323 acb_add_error_arb(acb_t x, const arb_t err)
0324 {
0325 arb_add_error(acb_realref(x), err);
0326 arb_add_error(acb_imagref(x), err);
0327 }
0328
0329 void acb_get_mag(mag_t z, const acb_t x);
0330
0331 void acb_get_mag_lower(mag_t z, const acb_t x);
0332
0333 void acb_get_abs_ubound_arf(arf_t u, const acb_t z, slong prec);
0334 void acb_get_abs_lbound_arf(arf_t u, const acb_t z, slong prec);
0335 void acb_get_rad_ubound_arf(arf_t u, const acb_t z, slong prec);
0336
0337 ACB_INLINE void
0338 acb_union(acb_t res, const acb_t x, const acb_t y, slong prec)
0339 {
0340 arb_union(acb_realref(res), acb_realref(x), acb_realref(y), prec);
0341 arb_union(acb_imagref(res), acb_imagref(x), acb_imagref(y), prec);
0342 }
0343
0344 void acb_arg(arb_t r, const acb_t z, slong prec);
0345
0346 void acb_sgn(acb_t res, const acb_t z, slong prec);
0347
0348 void acb_csgn(arb_t res, const acb_t z);
0349
0350 void acb_real_abs(acb_t res, const acb_t z, int analytic, slong prec);
0351 void acb_real_sgn(acb_t res, const acb_t z, int analytic, slong prec);
0352 void acb_real_heaviside(acb_t res, const acb_t z, int analytic, slong prec);
0353 void acb_real_floor(acb_t res, const acb_t z, int analytic, slong prec);
0354 void acb_real_ceil(acb_t res, const acb_t z, int analytic, slong prec);
0355 void acb_real_max(acb_t res, const acb_t x, const acb_t y, int analytic, slong prec);
0356 void acb_real_min(acb_t res, const acb_t x, const acb_t y, int analytic, slong prec);
0357 void acb_real_sqrtpos(acb_t res, const acb_t z, int analytic, slong prec);
0358
0359 void acb_sqrt_analytic(acb_t res, const acb_t z, int analytic, slong prec);
0360 void acb_rsqrt_analytic(acb_t res, const acb_t z, int analytic, slong prec);
0361 void acb_log_analytic(acb_t res, const acb_t z, int analytic, slong prec);
0362 void acb_pow_analytic(acb_t res, const acb_t z, const acb_t w, int analytic, slong prec);
0363
0364 ACB_INLINE void
0365 acb_add(acb_t z, const acb_t x, const acb_t y, slong prec)
0366 {
0367 arb_add(acb_realref(z), acb_realref(x), acb_realref(y), prec);
0368 arb_add(acb_imagref(z), acb_imagref(x), acb_imagref(y), prec);
0369 }
0370
0371 ACB_INLINE void
0372 acb_sub(acb_t z, const acb_t x, const acb_t y, slong prec)
0373 {
0374 arb_sub(acb_realref(z), acb_realref(x), acb_realref(y), prec);
0375 arb_sub(acb_imagref(z), acb_imagref(x), acb_imagref(y), prec);
0376 }
0377
0378 ACB_INLINE void
0379 acb_add_si(acb_t z, const acb_t x, slong c, slong prec)
0380 {
0381 arb_add_si(acb_realref(z), acb_realref(x), c, prec);
0382 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0383 }
0384
0385 ACB_INLINE void
0386 acb_add_ui(acb_t z, const acb_t x, ulong c, slong prec)
0387 {
0388 arb_add_ui(acb_realref(z), acb_realref(x), c, prec);
0389 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0390 }
0391
0392 ACB_INLINE void
0393 acb_sub_si(acb_t z, const acb_t x, slong c, slong prec)
0394 {
0395 arb_sub_si(acb_realref(z), acb_realref(x), c, prec);
0396 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0397 }
0398
0399 ACB_INLINE void
0400 acb_sub_ui(acb_t z, const acb_t x, ulong c, slong prec)
0401 {
0402 arb_sub_ui(acb_realref(z), acb_realref(x), c, prec);
0403 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0404 }
0405
0406 ACB_INLINE void
0407 acb_add_fmpz(acb_t z, const acb_t x, const fmpz_t y, slong prec)
0408 {
0409 arb_add_fmpz(acb_realref(z), acb_realref(x), y, prec);
0410 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0411 }
0412
0413 ACB_INLINE void
0414 acb_add_arb(acb_t z, const acb_t x, const arb_t y, slong prec)
0415 {
0416 arb_add(acb_realref(z), acb_realref(x), y, prec);
0417 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0418 }
0419
0420 ACB_INLINE void
0421 acb_sub_fmpz(acb_t z, const acb_t x, const fmpz_t y, slong prec)
0422 {
0423 arb_sub_fmpz(acb_realref(z), acb_realref(x), y, prec);
0424 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0425 }
0426
0427 ACB_INLINE void
0428 acb_sub_arb(acb_t z, const acb_t x, const arb_t y, slong prec)
0429 {
0430 arb_sub(acb_realref(z), acb_realref(x), y, prec);
0431 arb_set_round(acb_imagref(z), acb_imagref(x), prec);
0432 }
0433
0434 ACB_INLINE void
0435 acb_neg(acb_t z, const acb_t x)
0436 {
0437 arb_neg(acb_realref(z), acb_realref(x));
0438 arb_neg(acb_imagref(z), acb_imagref(x));
0439 }
0440
0441 ACB_INLINE void
0442 acb_conj(acb_t z, const acb_t x)
0443 {
0444 arb_set(acb_realref(z), acb_realref(x));
0445 arb_neg(acb_imagref(z), acb_imagref(x));
0446 }
0447
0448 ACB_INLINE void
0449 acb_abs(arb_t u, const acb_t z, slong prec)
0450 {
0451 arb_hypot(u, acb_realref(z), acb_imagref(z), prec);
0452 }
0453
0454 ACB_INLINE void
0455 acb_mul_arf(acb_t z, const acb_t x, const arf_t y, slong prec)
0456 {
0457 arb_mul_arf(acb_realref(z), acb_realref(x), y, prec);
0458 arb_mul_arf(acb_imagref(z), acb_imagref(x), y, prec);
0459 }
0460
0461 ACB_INLINE void
0462 acb_mul_ui(acb_t z, const acb_t x, ulong y, slong prec)
0463 {
0464 arf_t t;
0465 arf_init_set_ui(t, y);
0466 acb_mul_arf(z, x, t, prec);
0467 }
0468
0469 ACB_INLINE void
0470 acb_mul_si(acb_t z, const acb_t x, slong y, slong prec)
0471 {
0472 arf_t t;
0473 arf_init_set_si(t, y);
0474 acb_mul_arf(z, x, t, prec);
0475 }
0476
0477 ACB_INLINE void
0478 acb_mul_fmpz(acb_t z, const acb_t x, const fmpz_t y, slong prec)
0479 {
0480 arf_t t;
0481 arf_init(t);
0482 arf_set_fmpz(t, y);
0483 acb_mul_arf(z, x, t, prec);
0484 arf_clear(t);
0485 }
0486
0487 ACB_INLINE void
0488 acb_mul_arb(acb_t z, const acb_t x, const arb_t y, slong prec)
0489 {
0490 arb_mul(acb_realref(z), acb_realref(x), y, prec);
0491 arb_mul(acb_imagref(z), acb_imagref(x), y, prec);
0492 }
0493
0494 ACB_INLINE void
0495 acb_mul_onei(acb_t z, const acb_t x)
0496 {
0497 if (z == x)
0498 {
0499 arb_swap(acb_realref(z), acb_imagref(z));
0500 arb_neg(acb_realref(z), acb_realref(z));
0501 }
0502 else
0503 {
0504 arb_neg(acb_realref(z), acb_imagref(x));
0505 arb_set(acb_imagref(z), acb_realref(x));
0506 }
0507 }
0508
0509 ACB_INLINE void
0510 acb_div_onei(acb_t z, const acb_t x)
0511 {
0512 if (z == x)
0513 {
0514 arb_swap(acb_realref(z), acb_imagref(z));
0515 arb_neg(acb_imagref(z), acb_imagref(z));
0516 }
0517 else
0518 {
0519 arb_set(acb_realref(z), acb_imagref(x));
0520 arb_neg(acb_imagref(z), acb_realref(x));
0521 }
0522 }
0523
0524 ACB_INLINE void
0525 acb_mul_i_pow_si(acb_t z, const acb_t x, slong k)
0526 {
0527 k &= 3;
0528
0529 if (k == 0)
0530 acb_set(z, x);
0531 else if (k == 1)
0532 acb_mul_onei(z, x);
0533 else if (k == 2)
0534 acb_neg(z, x);
0535 else
0536 acb_div_onei(z, x);
0537 }
0538
0539 void acb_mul(acb_t z, const acb_t x, const acb_t y, slong prec);
0540
0541 void acb_mul_naive(acb_t z, const acb_t x, const acb_t y, slong prec);
0542
0543 ACB_INLINE void
0544 acb_mul_2exp_si(acb_t z, const acb_t x, slong e)
0545 {
0546 arb_mul_2exp_si(acb_realref(z), acb_realref(x), e);
0547 arb_mul_2exp_si(acb_imagref(z), acb_imagref(x), e);
0548 }
0549
0550 ACB_INLINE void
0551 acb_mul_2exp_fmpz(acb_t z, const acb_t x, const fmpz_t c)
0552 {
0553 arb_mul_2exp_fmpz(acb_realref(z), acb_realref(x), c);
0554 arb_mul_2exp_fmpz(acb_imagref(z), acb_imagref(x), c);
0555 }
0556
0557 void acb_addmul(acb_t z, const acb_t x, const acb_t y, slong prec);
0558
0559 void acb_submul(acb_t z, const acb_t x, const acb_t y, slong prec);
0560
0561 ACB_INLINE void
0562 acb_addmul_ui(acb_t z, const acb_t x, ulong y, slong prec)
0563 {
0564 arb_addmul_ui(acb_realref(z), acb_realref(x), y, prec);
0565 arb_addmul_ui(acb_imagref(z), acb_imagref(x), y, prec);
0566 }
0567
0568 ACB_INLINE void
0569 acb_addmul_si(acb_t z, const acb_t x, slong y, slong prec)
0570 {
0571 arb_addmul_si(acb_realref(z), acb_realref(x), y, prec);
0572 arb_addmul_si(acb_imagref(z), acb_imagref(x), y, prec);
0573 }
0574
0575 ACB_INLINE void
0576 acb_submul_ui(acb_t z, const acb_t x, ulong y, slong prec)
0577 {
0578 arb_submul_ui(acb_realref(z), acb_realref(x), y, prec);
0579 arb_submul_ui(acb_imagref(z), acb_imagref(x), y, prec);
0580 }
0581
0582 ACB_INLINE void
0583 acb_submul_si(acb_t z, const acb_t x, slong y, slong prec)
0584 {
0585 arb_submul_si(acb_realref(z), acb_realref(x), y, prec);
0586 arb_submul_si(acb_imagref(z), acb_imagref(x), y, prec);
0587 }
0588
0589 ACB_INLINE void
0590 acb_addmul_fmpz(acb_t z, const acb_t x, const fmpz_t y, slong prec)
0591 {
0592 arb_addmul_fmpz(acb_realref(z), acb_realref(x), y, prec);
0593 arb_addmul_fmpz(acb_imagref(z), acb_imagref(x), y, prec);
0594 }
0595
0596 ACB_INLINE void
0597 acb_submul_fmpz(acb_t z, const acb_t x, const fmpz_t y, slong prec)
0598 {
0599 arb_submul_fmpz(acb_realref(z), acb_realref(x), y, prec);
0600 arb_submul_fmpz(acb_imagref(z), acb_imagref(x), y, prec);
0601 }
0602
0603 ACB_INLINE void
0604 acb_addmul_arb(acb_t z, const acb_t x, const arb_t y, slong prec)
0605 {
0606 arb_addmul(acb_realref(z), acb_realref(x), y, prec);
0607 arb_addmul(acb_imagref(z), acb_imagref(x), y, prec);
0608 }
0609
0610 ACB_INLINE void
0611 acb_submul_arb(acb_t z, const acb_t x, const arb_t y, slong prec)
0612 {
0613 arb_submul(acb_realref(z), acb_realref(x), y, prec);
0614 arb_submul(acb_imagref(z), acb_imagref(x), y, prec);
0615 }
0616
0617 void acb_dot_simple(acb_t res, const acb_t initial, int subtract,
0618 acb_srcptr x, slong xstep, acb_srcptr y, slong ystep, slong len, slong prec);
0619 void acb_dot_precise(acb_t res, const acb_t initial, int subtract,
0620 acb_srcptr x, slong xstep, acb_srcptr y, slong ystep, slong len, slong prec);
0621 void acb_dot(acb_t res, const acb_t initial, int subtract,
0622 acb_srcptr x, slong xstep, acb_srcptr y, slong ystep, slong len, slong prec);
0623
0624 void acb_approx_dot(acb_t res, const acb_t initial, int subtract,
0625 acb_srcptr x, slong xstep, acb_srcptr y, slong ystep, slong len, slong prec);
0626
0627 void acb_dot_ui(acb_t res, const acb_t initial, int subtract,
0628 acb_srcptr x, slong xstep, const ulong * y, slong ystep, slong len, slong prec);
0629 void acb_dot_si(acb_t res, const acb_t initial, int subtract,
0630 acb_srcptr x, slong xstep, const slong * y, slong ystep, slong len, slong prec);
0631 void acb_dot_uiui(acb_t res, const acb_t initial, int subtract,
0632 acb_srcptr x, slong xstep, const ulong * y, slong ystep, slong len, slong prec);
0633 void acb_dot_siui(acb_t res, const acb_t initial, int subtract,
0634 acb_srcptr x, slong xstep, const ulong * y, slong ystep, slong len, slong prec);
0635 void acb_dot_fmpz(acb_t res, const acb_t initial, int subtract,
0636 acb_srcptr x, slong xstep, const fmpz * y, slong ystep, slong len, slong prec);
0637
0638 void acb_inv(acb_t z, const acb_t x, slong prec);
0639
0640 void acb_div(acb_t z, const acb_t x, const acb_t y, slong prec);
0641
0642 ACB_INLINE void
0643 acb_div_ui(acb_t z, const acb_t x, ulong c, slong prec)
0644 {
0645 arb_div_ui(acb_realref(z), acb_realref(x), c, prec);
0646 arb_div_ui(acb_imagref(z), acb_imagref(x), c, prec);
0647 }
0648
0649 ACB_INLINE void
0650 acb_div_si(acb_t z, const acb_t x, slong c, slong prec)
0651 {
0652 arb_div_si(acb_realref(z), acb_realref(x), c, prec);
0653 arb_div_si(acb_imagref(z), acb_imagref(x), c, prec);
0654 }
0655
0656 ACB_INLINE void
0657 acb_div_arb(acb_t z, const acb_t x, const arb_t c, slong prec)
0658 {
0659 arb_div(acb_realref(z), acb_realref(x), c, prec);
0660 arb_div(acb_imagref(z), acb_imagref(x), c, prec);
0661 }
0662
0663 ACB_INLINE void
0664 acb_div_fmpz(acb_t z, const acb_t x, const fmpz_t c, slong prec)
0665 {
0666 arb_div_fmpz(acb_realref(z), acb_realref(x), c, prec);
0667 arb_div_fmpz(acb_imagref(z), acb_imagref(x), c, prec);
0668 }
0669
0670 void acb_cube(acb_t y, const acb_t x, slong prec);
0671 void acb_pow_fmpz(acb_t y, const acb_t b, const fmpz_t e, slong prec);
0672 void acb_pow_ui(acb_t y, const acb_t b, ulong e, slong prec);
0673 void acb_pow_si(acb_t y, const acb_t b, slong e, slong prec);
0674
0675 ACB_INLINE void
0676 acb_const_pi(acb_t x, slong prec)
0677 {
0678 arb_const_pi(acb_realref(x), prec);
0679 arb_zero(acb_imagref(x));
0680 }
0681
0682 void acb_log(acb_t r, const acb_t z, slong prec);
0683 void acb_log1p(acb_t r, const acb_t z, slong prec);
0684
0685 void acb_exp(acb_t r, const acb_t z, slong prec);
0686 void acb_exp_pi_i(acb_t r, const acb_t z, slong prec);
0687 void acb_exp_invexp(acb_t r, acb_t s, const acb_t z, slong prec);
0688 void acb_expm1(acb_t r, const acb_t z, slong prec);
0689
0690 void acb_sin(acb_t r, const acb_t z, slong prec);
0691 void acb_cos(acb_t r, const acb_t z, slong prec);
0692 void acb_sin_cos(acb_t s, acb_t c, const acb_t z, slong prec);
0693 void acb_tan(acb_t r, const acb_t z, slong prec);
0694 void acb_cot(acb_t r, const acb_t z, slong prec);
0695
0696 void acb_asin(acb_t r, const acb_t z, slong prec);
0697 void acb_acos(acb_t r, const acb_t z, slong prec);
0698 void acb_atan(acb_t r, const acb_t z, slong prec);
0699 void acb_asinh(acb_t r, const acb_t z, slong prec);
0700 void acb_acosh(acb_t r, const acb_t z, slong prec);
0701 void acb_atanh(acb_t r, const acb_t z, slong prec);
0702
0703 ACB_INLINE void
0704 acb_sinh(acb_t y, const acb_t x, slong prec)
0705 {
0706 acb_mul_onei(y, x);
0707 acb_sin(y, y, prec);
0708 acb_div_onei(y, y);
0709 }
0710
0711 ACB_INLINE void
0712 acb_cosh(acb_t y, const acb_t x, slong prec)
0713 {
0714 acb_mul_onei(y, x);
0715 acb_cos(y, y, prec);
0716 }
0717
0718 ACB_INLINE void
0719 acb_sinh_cosh(acb_t y, acb_t z, const acb_t x, slong prec)
0720 {
0721 acb_mul_onei(y, x);
0722 acb_sin_cos(y, z, y, prec);
0723 acb_div_onei(y, y);
0724 }
0725
0726 ACB_INLINE void
0727 acb_tanh(acb_t y, const acb_t x, slong prec)
0728 {
0729 acb_mul_onei(y, x);
0730 acb_tan(y, y, prec);
0731 acb_div_onei(y, y);
0732 }
0733
0734 ACB_INLINE void
0735 acb_coth(acb_t y, const acb_t x, slong prec)
0736 {
0737 acb_mul_onei(y, x);
0738 acb_cot(y, y, prec);
0739 acb_mul_onei(y, y);
0740 }
0741
0742 void acb_sech(acb_t r, const acb_t z, slong prec);
0743 void acb_csch(acb_t r, const acb_t z, slong prec);
0744
0745 ACB_INLINE void
0746 acb_sec(acb_t y, const acb_t x, slong prec)
0747 {
0748 acb_mul_onei(y, x);
0749 acb_sech(y, y, prec);
0750 }
0751
0752 ACB_INLINE void
0753 acb_csc(acb_t y, const acb_t x, slong prec)
0754 {
0755 acb_mul_onei(y, x);
0756 acb_csch(y, y, prec);
0757 acb_mul_onei(y, y);
0758 }
0759
0760 void acb_sin_pi(acb_t r, const acb_t z, slong prec);
0761 void acb_cos_pi(acb_t r, const acb_t z, slong prec);
0762 void acb_sin_cos_pi(acb_t s, acb_t c, const acb_t z, slong prec);
0763 void acb_tan_pi(acb_t r, const acb_t z, slong prec);
0764 void acb_cot_pi(acb_t r, const acb_t z, slong prec);
0765 void acb_csc_pi(acb_t y, const acb_t x, slong prec);
0766
0767 void acb_sinc(acb_t res, const acb_t z, slong prec);
0768 void acb_sinc_pi(acb_t res, const acb_t z, slong prec);
0769
0770 void acb_pow_arb(acb_t z, const acb_t x, const arb_t y, slong prec);
0771 void acb_pow(acb_t r, const acb_t x, const acb_t y, slong prec);
0772
0773 void acb_sqrt(acb_t y, const acb_t x, slong prec);
0774 void acb_rsqrt(acb_t y, const acb_t x, slong prec);
0775 void acb_sqrts(acb_t y1, acb_t y2, const acb_t x, slong prec);
0776
0777 void acb_root_ui(acb_t y, const acb_t x, ulong k, slong prec);
0778
0779 void acb_quadratic_roots_fmpz(acb_t r1, acb_t r2,
0780 const fmpz_t a, const fmpz_t b, const fmpz_t c, slong prec);
0781
0782 void acb_chebyshev_t_ui(acb_t a, ulong n, const acb_t x, slong prec);
0783 void acb_chebyshev_t2_ui(acb_t a, acb_t b, ulong n, const acb_t x, slong prec);
0784 void acb_chebyshev_u_ui(acb_t a, ulong n, const acb_t x, slong prec);
0785 void acb_chebyshev_u2_ui(acb_t a, acb_t b, ulong n, const acb_t x, slong prec);
0786
0787 void acb_rising_ui(acb_t z, const acb_t x, ulong n, slong prec);
0788 void acb_rising(acb_t z, const acb_t x, const acb_t n, slong prec);
0789 void acb_rising2_ui(acb_t u, acb_t v, const acb_t x, ulong n, slong prec);
0790
0791 void acb_rising_ui_get_mag(mag_t bound, const acb_t s, ulong n);
0792
0793 void acb_gamma(acb_t y, const acb_t x, slong prec);
0794 void acb_rgamma(acb_t y, const acb_t x, slong prec);
0795 void acb_lgamma(acb_t y, const acb_t x, slong prec);
0796 void acb_log_sin_pi(acb_t res, const acb_t z, slong prec);
0797 void acb_digamma(acb_t y, const acb_t x, slong prec);
0798 void acb_zeta(acb_t z, const acb_t s, slong prec);
0799 void acb_hurwitz_zeta(acb_t z, const acb_t s, const acb_t a, slong prec);
0800 void acb_polygamma(acb_t res, const acb_t s, const acb_t z, slong prec);
0801
0802 void acb_bernoulli_poly_ui(acb_t res, ulong n, const acb_t x, slong prec);
0803
0804 void acb_log_barnes_g(acb_t res, const acb_t z, slong prec);
0805 void acb_barnes_g(acb_t res, const acb_t z, slong prec);
0806
0807 void acb_polylog(acb_t w, const acb_t s, const acb_t z, slong prec);
0808 void acb_polylog_si(acb_t w, slong s, const acb_t z, slong prec);
0809
0810 void acb_agm1(acb_t m, const acb_t z, slong prec);
0811 void acb_agm1_cpx(acb_ptr m, const acb_t z, slong len, slong prec);
0812 void acb_agm(acb_t res, const acb_t a, const acb_t b, slong prec);
0813
0814 #define ACB_LAMBERTW_LEFT 2
0815 #define ACB_LAMBERTW_MIDDLE 4
0816
0817 void acb_lambertw_asymp(acb_t res, const acb_t z, const fmpz_t k, slong L, slong M, slong prec);
0818 int acb_lambertw_check_branch(const acb_t w, const fmpz_t k, slong prec);
0819 void acb_lambertw_bound_deriv(mag_t res, const acb_t z, const acb_t ez1, const fmpz_t k);
0820 void acb_lambertw(acb_t res, const acb_t z, const fmpz_t k, int flags, slong prec);
0821
0822 ACB_INLINE void
0823 acb_sqr(acb_t res, const acb_t val, slong prec)
0824 {
0825 acb_mul(res, val, val, prec);
0826 }
0827
0828 ACB_INLINE int
0829 acb_is_finite(const acb_t x)
0830 {
0831 return arb_is_finite(acb_realref(x)) && arb_is_finite(acb_imagref(x));
0832 }
0833
0834 ACB_INLINE void
0835 acb_indeterminate(acb_t x)
0836 {
0837 arb_indeterminate(acb_realref(x));
0838 arb_indeterminate(acb_imagref(x));
0839 }
0840
0841 acb_ptr _acb_vec_entry_ptr(acb_ptr vec, slong i);
0842
0843 void _acb_vec_zero(acb_ptr A, slong n);
0844 int _acb_vec_is_zero(acb_srcptr vec, slong len);
0845 void _acb_vec_set(acb_ptr res, acb_srcptr vec, slong len);
0846 void _acb_vec_set_round(acb_ptr res, acb_srcptr vec, slong len, slong prec);
0847 void _acb_vec_swap(acb_ptr res, acb_ptr vec, slong len);
0848 void _acb_vec_neg(acb_ptr res, acb_srcptr vec, slong len);
0849 void _acb_vec_add(acb_ptr res, acb_srcptr vec1, acb_srcptr vec2, slong len, slong prec);
0850 void _acb_vec_sub(acb_ptr res, acb_srcptr vec1, acb_srcptr vec2, slong len, slong prec);
0851 void _acb_vec_scalar_submul(acb_ptr res, acb_srcptr vec, slong len, const acb_t c, slong prec);
0852 void _acb_vec_scalar_addmul(acb_ptr res, acb_srcptr vec, slong len, const acb_t c, slong prec);
0853 void _acb_vec_scalar_mul(acb_ptr res, acb_srcptr vec, slong len, const acb_t c, slong prec);
0854 void _acb_vec_scalar_mul_arb(acb_ptr res, acb_srcptr vec, slong len, const arb_t c, slong prec);
0855 void _acb_vec_scalar_mul_arf(acb_ptr res, acb_srcptr vec, slong len, const arf_t c, slong prec);
0856 void _acb_vec_scalar_mul_ui(acb_ptr res, acb_srcptr vec, slong len, ulong c, slong prec);
0857 void _acb_vec_scalar_mul_si(acb_ptr res, acb_srcptr vec, slong len, slong c, slong prec);
0858 void _acb_vec_scalar_mul_fmpz(acb_ptr res, acb_srcptr vec, slong len, const fmpz_t c, slong prec);
0859 void _acb_vec_scalar_mul_2exp_si(acb_ptr res, acb_srcptr vec, slong len, slong c);
0860 void _acb_vec_scalar_mul_onei(acb_ptr res, acb_srcptr vec, slong len);
0861 void _acb_vec_scalar_div_ui(acb_ptr res, acb_srcptr vec, slong len, ulong c, slong prec);
0862 void _acb_vec_scalar_div(acb_ptr res, acb_srcptr vec, slong len, const acb_t c, slong prec);
0863 void _acb_vec_scalar_div_arb(acb_ptr res, acb_srcptr vec, slong len, const arb_t c, slong prec);
0864 void _acb_vec_scalar_mul_fmpz(acb_ptr res, acb_srcptr vec, slong len, const fmpz_t c, slong prec);
0865 void _acb_vec_scalar_div_fmpz(acb_ptr res, acb_srcptr vec, slong len, const fmpz_t c, slong prec);
0866 void _acb_vec_sqr(acb_ptr res, acb_srcptr vec, slong len, slong prec);
0867
0868 #ifdef FLINT_HAVE_FILE
0869 void acb_fprint(FILE * file, const acb_t x);
0870 void acb_fprintd(FILE * file, const acb_t z, slong digits);
0871 void acb_fprintn(FILE * fp, const acb_t z, slong digits, ulong flags);
0872 #endif
0873
0874 void acb_print(const acb_t x);
0875 void acb_printd(const acb_t z, slong digits);
0876 void acb_printn(const acb_t x, slong digits, ulong flags);
0877
0878 void _acb_vec_printd(acb_srcptr vec, slong len, slong ndigits);
0879 void _acb_vec_printn(acb_srcptr vec, slong len, slong ndigits, ulong flags);
0880
0881 void acb_randtest(acb_t z, flint_rand_t state, slong prec, slong mag_bits);
0882
0883 void acb_randtest_special(acb_t z, flint_rand_t state, slong prec, slong mag_bits);
0884
0885 void acb_randtest_precise(acb_t z, flint_rand_t state, slong prec, slong mag_bits);
0886
0887 void acb_randtest_param(acb_t z, flint_rand_t state, slong prec, slong mag_bits);
0888
0889 void acb_urandom(acb_t z, flint_rand_t state, slong prec);
0890
0891 slong acb_rel_error_bits(const acb_t x);
0892
0893 ACB_INLINE slong
0894 acb_rel_accuracy_bits(const acb_t x)
0895 {
0896 return -acb_rel_error_bits(x);
0897 }
0898
0899 slong acb_rel_one_accuracy_bits(const acb_t x);
0900
0901 ACB_INLINE slong
0902 acb_bits(const acb_t x)
0903 {
0904 slong b1, b2;
0905 b1 = arb_bits(acb_realref(x));
0906 b2 = arb_bits(acb_imagref(x));
0907 return FLINT_MAX(b1, b2);
0908 }
0909
0910 ACB_INLINE int
0911 acb_is_real(const acb_t x)
0912 {
0913 return arb_is_zero(acb_imagref(x));
0914 }
0915
0916 int _acb_vec_is_real(acb_srcptr v, slong len);
0917 int _acb_vec_is_finite(acb_srcptr vec, slong len);
0918 int _acb_vec_equal(acb_srcptr vec1, acb_srcptr vec2, slong len);
0919 int _acb_vec_overlaps(acb_srcptr vec1, acb_srcptr vec2, slong len);
0920 int _acb_vec_contains(acb_srcptr vec1, acb_srcptr vec2, slong len);
0921 void _acb_vec_get_real(arb_ptr re, acb_srcptr vec, slong len);
0922 void _acb_vec_get_imag(arb_ptr im, acb_srcptr vec, slong len);
0923 void _acb_vec_set_real_imag(acb_ptr vec, arb_srcptr re, arb_srcptr im, slong len);
0924 slong _acb_vec_bits(acb_srcptr vec, slong len);
0925
0926 void _acb_vec_set_powers(acb_ptr xs, const acb_t x, slong len, slong prec);
0927
0928 void _acb_vec_add_error_arf_vec(acb_ptr res, arf_srcptr err, slong len);
0929 void _acb_vec_add_error_mag_vec(acb_ptr res, mag_srcptr err, slong len);
0930 void _acb_vec_indeterminate(acb_ptr vec, slong len);
0931 void _acb_vec_trim(acb_ptr res, acb_srcptr vec, slong len);
0932 int _acb_vec_get_unique_fmpz_vec(fmpz * res, acb_srcptr vec, slong len);
0933
0934
0935 void _acb_vec_sort_pretty(acb_ptr vec, slong len);
0936
0937
0938 void acb_unit_root(acb_t res, ulong order, slong prec);
0939 void _acb_vec_unit_roots(acb_ptr z, slong order, slong len, slong prec);
0940
0941 ACB_INLINE slong
0942 acb_allocated_bytes(const acb_t x)
0943 {
0944 return arb_allocated_bytes(acb_realref(x)) + arb_allocated_bytes(acb_imagref(x));
0945 }
0946
0947 slong _acb_vec_allocated_bytes(acb_srcptr vec, slong len);
0948 double _acb_vec_estimate_allocated_bytes(slong len, slong prec);
0949
0950 #ifdef __cplusplus
0951 }
0952 #endif
0953
0954 #endif