mirror of
https://github.com/vale981/arb
synced 2025-03-04 17:01:40 -05:00
Declare variables at the top of every function
This commit is contained in:
parent
89545adbcc
commit
d642a9ae71
4 changed files with 18 additions and 16 deletions
|
@ -14,8 +14,7 @@
|
|||
void
|
||||
_acb_poly_graeffe_transform(acb_ptr b, acb_srcptr a, slong len, slong prec)
|
||||
{
|
||||
slong lo, le, ls;
|
||||
slong i;
|
||||
slong lo, le, ls, deg, i;
|
||||
acb_ptr pe, po;
|
||||
|
||||
if (len <= 1)
|
||||
|
@ -24,13 +23,14 @@ _acb_poly_graeffe_transform(acb_ptr b, acb_srcptr a, slong len, slong prec)
|
|||
return;
|
||||
}
|
||||
|
||||
deg = len - 1;
|
||||
lo = len / 2;
|
||||
ls = 2 * lo - 1;
|
||||
le = (len - 1) / 2 + 1;
|
||||
le = deg / 2 + 1;
|
||||
po = _acb_vec_init(lo);
|
||||
pe = _acb_vec_init(FLINT_MAX(le, ls));
|
||||
|
||||
for (i = len - 1; i >= 0; i--)
|
||||
for (i = deg; i >= 0; i--)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
acb_set(pe + i / 2, a + i);
|
||||
|
@ -44,8 +44,8 @@ _acb_poly_graeffe_transform(acb_ptr b, acb_srcptr a, slong len, slong prec)
|
|||
|
||||
if (len % 2 == 0)
|
||||
{
|
||||
_acb_vec_neg(b, b, len - 1);
|
||||
acb_set(b + (len - 1), pe + (len - 2));
|
||||
_acb_vec_neg(b, b, deg);
|
||||
acb_set(b + deg, pe + (deg - 1));
|
||||
}
|
||||
|
||||
_acb_vec_clear(pe, FLINT_MAX(le, ls));
|
||||
|
|
|
@ -15,13 +15,13 @@ int main()
|
|||
{
|
||||
slong iter;
|
||||
flint_rand_t state;
|
||||
acb_poly_t a, b, c;
|
||||
|
||||
flint_printf("graeffe_transform....");
|
||||
fflush(stdout);
|
||||
|
||||
flint_randinit(state);
|
||||
|
||||
acb_poly_t a, b, c;
|
||||
acb_poly_init(a);
|
||||
acb_poly_init(b);
|
||||
acb_poly_init(c);
|
||||
|
@ -31,6 +31,7 @@ int main()
|
|||
for (iter = 0; iter < 200 * arb_test_multiplier(); iter++)
|
||||
{
|
||||
slong n, prec, i;
|
||||
|
||||
n = n_randint(state, 20);
|
||||
prec = 2 + n_randint(state, 256);
|
||||
|
||||
|
@ -47,7 +48,7 @@ int main()
|
|||
acb_poly_graeffe_transform(b, a, prec);
|
||||
if (!acb_poly_overlaps(b, c))
|
||||
{
|
||||
flint_printf("FAIL (containment)\n\n");
|
||||
flint_printf("FAIL (overlap)\n\n");
|
||||
flint_printf("n = %wd, prec = %wd\n\n", n, prec);
|
||||
|
||||
flint_printf("a: "); acb_poly_printd(a, 15); flint_printf("\n\n");
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
void
|
||||
_arb_poly_graeffe_transform(arb_ptr b, arb_srcptr a, slong len, slong prec)
|
||||
{
|
||||
slong lo, le, ls;
|
||||
slong i;
|
||||
slong lo, le, ls, deg, i;
|
||||
arb_ptr pe, po;
|
||||
|
||||
if (len <= 1)
|
||||
|
@ -24,13 +23,14 @@ _arb_poly_graeffe_transform(arb_ptr b, arb_srcptr a, slong len, slong prec)
|
|||
return;
|
||||
}
|
||||
|
||||
deg = len - 1;
|
||||
lo = len / 2;
|
||||
ls = 2 * lo - 1;
|
||||
le = (len - 1) / 2 + 1;
|
||||
le = deg / 2 + 1;
|
||||
po = _arb_vec_init(lo);
|
||||
pe = _arb_vec_init(FLINT_MAX(le, ls));
|
||||
|
||||
for (i = len - 1; i >= 0; i--)
|
||||
for (i = deg; i >= 0; i--)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
arb_set(pe + i / 2, a + i);
|
||||
|
@ -44,8 +44,8 @@ _arb_poly_graeffe_transform(arb_ptr b, arb_srcptr a, slong len, slong prec)
|
|||
|
||||
if (len % 2 == 0)
|
||||
{
|
||||
_arb_vec_neg(b, b, len - 1);
|
||||
arb_set(b + (len - 1), pe + (len - 2));
|
||||
_arb_vec_neg(b, b, deg);
|
||||
arb_set(b + deg, pe + (deg - 1));
|
||||
}
|
||||
|
||||
_arb_vec_clear(pe, FLINT_MAX(le, ls));
|
||||
|
|
|
@ -15,13 +15,13 @@ int main()
|
|||
{
|
||||
slong iter;
|
||||
flint_rand_t state;
|
||||
arb_poly_t a, b, c;
|
||||
|
||||
flint_printf("graeffe_transform....");
|
||||
fflush(stdout);
|
||||
|
||||
flint_randinit(state);
|
||||
|
||||
arb_poly_t a, b, c;
|
||||
arb_poly_init(a);
|
||||
arb_poly_init(b);
|
||||
arb_poly_init(c);
|
||||
|
@ -31,6 +31,7 @@ int main()
|
|||
for (iter = 0; iter < 200 * arb_test_multiplier(); iter++)
|
||||
{
|
||||
slong n, prec, i;
|
||||
|
||||
n = n_randint(state, 20);
|
||||
prec = 2 + n_randint(state, 256);
|
||||
|
||||
|
@ -47,7 +48,7 @@ int main()
|
|||
arb_poly_graeffe_transform(b, a, prec);
|
||||
if (!arb_poly_overlaps(b, c))
|
||||
{
|
||||
flint_printf("FAIL (containment)\n\n");
|
||||
flint_printf("FAIL (overlap)\n\n");
|
||||
flint_printf("n = %wd, prec = %wd\n\n", n, prec);
|
||||
|
||||
flint_printf("a: "); arb_poly_printd(a, 15); flint_printf("\n\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue