mirror of
https://github.com/vale981/arb
synced 2025-03-04 17:01:40 -05:00
rename arb_root -> arb_root_ui for consistency (but keep alias)
This commit is contained in:
parent
befc11cc95
commit
41758f8c55
9 changed files with 32 additions and 20 deletions
|
@ -30,7 +30,7 @@ arb_const_airy_ai0_eval(arb_t y, slong prec)
|
|||
{
|
||||
arb_t t; fmpq_t v; arb_init(t); fmpq_init(v);
|
||||
arb_set_ui(y, 3);
|
||||
arb_root(y, y, 3, prec + 5); arb_mul(y, y, y, prec + 5);
|
||||
arb_root_ui(y, y, 3, prec + 5); arb_mul(y, y, y, prec + 5);
|
||||
fmpq_set_si(v, 2, 3); arb_gamma_fmpq(t, v, prec + 5);
|
||||
arb_mul(y, y, t, prec + 5);
|
||||
arb_inv(y, y, prec);
|
||||
|
@ -42,7 +42,7 @@ arb_const_airy_ai1_eval(arb_t y, slong prec)
|
|||
{
|
||||
arb_t t; fmpq_t v; arb_init(t); fmpq_init(v);
|
||||
arb_set_ui(y, 3);
|
||||
arb_root(y, y, 3, prec + 5);
|
||||
arb_root_ui(y, y, 3, prec + 5);
|
||||
fmpq_set_si(v, 1, 3); arb_gamma_fmpq(t, v, prec + 5);
|
||||
arb_mul(y, y, t, prec + 5);
|
||||
arb_inv(y, y, prec); arb_neg(y, y);
|
||||
|
@ -54,7 +54,7 @@ arb_const_airy_bi0_eval(arb_t y, slong prec)
|
|||
{
|
||||
arb_t t; fmpq_t v; arb_init(t); fmpq_init(v);
|
||||
arb_set_ui(y, 3);
|
||||
arb_root(y, y, 6, prec + 5);
|
||||
arb_root_ui(y, y, 6, prec + 5);
|
||||
fmpq_set_si(v, 2, 3); arb_gamma_fmpq(t, v, prec + 5);
|
||||
arb_mul(y, y, t, prec + 5);
|
||||
arb_inv(y, y, prec);
|
||||
|
@ -66,7 +66,7 @@ arb_const_airy_bi1_eval(arb_t y, slong prec)
|
|||
{
|
||||
arb_t t; fmpq_t v; arb_init(t); fmpq_init(v);
|
||||
arb_set_ui(y, 3);
|
||||
arb_root(y, y, 6, prec + 5);
|
||||
arb_root_ui(y, y, 6, prec + 5);
|
||||
fmpq_set_si(v, 1, 3); arb_gamma_fmpq(t, v, prec + 5);
|
||||
arb_div(y, y, t, prec);
|
||||
arb_clear(t); fmpq_clear(v);
|
||||
|
|
|
@ -135,7 +135,7 @@ int main()
|
|||
arb_mul_2exp_si(t, t, -2);
|
||||
arb_gamma(t, t, prec);
|
||||
arb_const_pi(u, prec);
|
||||
arb_root(u, u, 4, prec);
|
||||
arb_root_ui(u, u, 4, prec);
|
||||
arb_pow_ui(u, u, 3, prec);
|
||||
arb_div(t, t, u, prec);
|
||||
arb_mul_2exp_si(t, t, -1);
|
||||
|
|
3
arb.h
3
arb.h
|
@ -576,7 +576,8 @@ void arb_pow_fmpq(arb_t y, const arb_t x, const fmpq_t a, slong prec);
|
|||
|
||||
void arb_div_2expm1_ui(arb_t z, const arb_t x, ulong n, slong prec);
|
||||
void arb_pow(arb_t z, const arb_t x, const arb_t y, slong prec);
|
||||
void arb_root(arb_t z, const arb_t x, ulong k, slong prec);
|
||||
void arb_root_ui(arb_t z, const arb_t x, ulong k, slong prec);
|
||||
void arb_root(arb_t z, const arb_t x, ulong k, slong prec); /* back compat */
|
||||
void arb_log(arb_t z, const arb_t x, slong prec);
|
||||
void arb_log_arf(arb_t z, const arf_t x, slong prec);
|
||||
void arb_log_ui(arb_t z, ulong x, slong prec);
|
||||
|
|
|
@ -533,8 +533,8 @@ arb_gamma_const_1_3_eval(arb_t s, slong prec)
|
|||
arb_mul(s, s, u, wp);
|
||||
|
||||
arb_div(s, s, t, wp);
|
||||
arb_root(s, s, 2, wp);
|
||||
arb_root(s, s, 3, prec);
|
||||
arb_root_ui(s, s, 2, wp);
|
||||
arb_root_ui(s, s, 3, prec);
|
||||
|
||||
hypgeom_clear(series);
|
||||
arb_clear(t);
|
||||
|
@ -628,7 +628,7 @@ arb_gamma_small_frac(arb_t y, unsigned int p, unsigned int q, slong prec)
|
|||
arb_div_ui(t, t, 3, wp);
|
||||
arb_sqrt(t, t, wp);
|
||||
arb_set_ui(y, 2);
|
||||
arb_root(y, y, 3, wp);
|
||||
arb_root_ui(y, y, 3, wp);
|
||||
arb_mul(t, t, y, wp);
|
||||
arb_gamma_const_1_3(y, wp);
|
||||
arb_mul(y, y, y, prec);
|
||||
|
|
|
@ -53,7 +53,7 @@ arb_pow_fmpq(arb_t y, const arb_t x, const fmpq_t a, slong prec)
|
|||
}
|
||||
else
|
||||
{
|
||||
arb_root(y, x, k, prec);
|
||||
arb_root_ui(y, x, k, prec);
|
||||
arb_pow_fmpz(y, y, fmpq_numref(a), prec);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ arb_root_arf(arb_t z, const arf_t x, ulong k, slong prec)
|
|||
}
|
||||
|
||||
void
|
||||
arb_root_algebraic(arb_t res, const arb_t x, ulong k, slong prec)
|
||||
arb_root_ui_algebraic(arb_t res, const arb_t x, ulong k, slong prec)
|
||||
{
|
||||
mag_t r, msubr, m1k, t;
|
||||
|
||||
|
@ -87,7 +87,7 @@ arb_root_algebraic(arb_t res, const arb_t x, ulong k, slong prec)
|
|||
}
|
||||
|
||||
void
|
||||
arb_root_exp(arb_t res, const arb_t x, ulong k, slong prec)
|
||||
arb_root_ui_exp(arb_t res, const arb_t x, ulong k, slong prec)
|
||||
{
|
||||
arb_log(res, x, prec + 4);
|
||||
arb_div_ui(res, res, k, prec + 4);
|
||||
|
@ -95,7 +95,7 @@ arb_root_exp(arb_t res, const arb_t x, ulong k, slong prec)
|
|||
}
|
||||
|
||||
void
|
||||
arb_root(arb_t res, const arb_t x, ulong k, slong prec)
|
||||
arb_root_ui(arb_t res, const arb_t x, ulong k, slong prec)
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
|
@ -117,9 +117,16 @@ arb_root(arb_t res, const arb_t x, ulong k, slong prec)
|
|||
else
|
||||
{
|
||||
if (k > 50 || prec < (WORD(1) << ((k / 8) + 8)))
|
||||
arb_root_exp(res, x, k, prec);
|
||||
arb_root_ui_exp(res, x, k, prec);
|
||||
else
|
||||
arb_root_algebraic(res, x, k, prec);
|
||||
arb_root_ui_algebraic(res, x, k, prec);
|
||||
}
|
||||
}
|
||||
|
||||
/* backwards compatible alias */
|
||||
void
|
||||
arb_root(arb_t res, const arb_t x, ulong k, slong prec)
|
||||
{
|
||||
arb_root_ui(res, x, k, prec);
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ int main()
|
|||
slong iter;
|
||||
flint_rand_t state;
|
||||
|
||||
flint_printf("root....");
|
||||
flint_printf("root_ui....");
|
||||
fflush(stdout);
|
||||
|
||||
flint_randinit(state);
|
||||
|
@ -51,7 +51,7 @@ int main()
|
|||
arb_randtest(a, state, 1 + n_randint(state, 2000), 1 + n_randint(state, 100));
|
||||
arb_randtest(b, state, 1 + n_randint(state, 2000), 1 + n_randint(state, 100));
|
||||
|
||||
arb_root(b, a, k, prec);
|
||||
arb_root_ui(b, a, k, prec);
|
||||
arb_pow_ui(c, b, k, prec);
|
||||
|
||||
if (!arb_contains(c, a))
|
||||
|
@ -64,7 +64,7 @@ int main()
|
|||
abort();
|
||||
}
|
||||
|
||||
arb_root(a, a, k, prec);
|
||||
arb_root_ui(a, a, k, prec);
|
||||
|
||||
if (!arb_equal(a, b))
|
||||
{
|
|
@ -691,7 +691,7 @@ Powers and roots
|
|||
|
||||
Sets `z = \sqrt{1+x}-1`, computed accurately when `x \approx 0`.
|
||||
|
||||
.. function:: void arb_root(arb_t z, const arb_t x, ulong k, slong prec)
|
||||
.. function:: void arb_root_ui(arb_t z, const arb_t x, ulong k, slong prec)
|
||||
|
||||
Sets *z* to the *k*-th root of *x*, rounded to *prec* bits.
|
||||
This function selects between different algorithms. For large *k*,
|
||||
|
@ -712,6 +712,10 @@ Powers and roots
|
|||
|
||||
This is evaluated using :func:`mag_log1p`.
|
||||
|
||||
.. function:: void arb_root(arb_t z, const arb_t x, ulong k, slong prec)
|
||||
|
||||
Alias for :func:`arb_root_ui`, provided for backwards compatibility.
|
||||
|
||||
.. function:: void arb_pow_fmpz_binexp(arb_t y, const arb_t b, const fmpz_t e, slong prec)
|
||||
|
||||
.. function:: void arb_pow_fmpz(arb_t y, const arb_t b, const fmpz_t e, slong prec)
|
||||
|
|
|
@ -221,7 +221,7 @@ sinh_cosh_divk_precomp(arb_t sh, arb_t ch, arb_t ex, slong k, slong prec)
|
|||
arb_t t;
|
||||
arb_init(t);
|
||||
arb_set_round(t, ex, prec);
|
||||
arb_root(ch, t, k, prec);
|
||||
arb_root_ui(ch, t, k, prec);
|
||||
/* The second term doesn't need full precision,
|
||||
but this doesn't affect performance that much... */
|
||||
arb_inv(t, ch, prec);
|
||||
|
|
Loading…
Add table
Reference in a new issue