mirror of
https://github.com/vale981/arb
synced 2025-03-05 09:21:38 -05:00
change loop order (last component first)
This commit is contained in:
parent
64a1650e69
commit
7d9ead1e4d
13 changed files with 32 additions and 39 deletions
|
@ -30,7 +30,7 @@ acb_dirichlet_conrey_next(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t
|
|||
{
|
||||
/* update index */
|
||||
int k;
|
||||
for (k=0; k < G->num; k++)
|
||||
for (k = G->num - 1; k >= 0; k--)
|
||||
{
|
||||
x->n = nmod_mul(x->n, G->generators[k], G->mod);
|
||||
x->log[k] += 1;
|
||||
|
|
|
@ -30,7 +30,8 @@ acb_dirichlet_conrey_next_primitive(acb_dirichlet_conrey_t x, const acb_dirichle
|
|||
{
|
||||
/* update index avoiding multiples of p except for first component
|
||||
if 8|q */
|
||||
ulong k = 0;
|
||||
slong k = 0;
|
||||
/*
|
||||
if (G->neven == 2)
|
||||
{
|
||||
x->n = nmod_mul(x->n, G->generators[0], G->mod);
|
||||
|
@ -40,14 +41,18 @@ acb_dirichlet_conrey_next_primitive(acb_dirichlet_conrey_t x, const acb_dirichle
|
|||
x->log[0] = 0;
|
||||
k = 1;
|
||||
}
|
||||
for (; k < G->num ; k++)
|
||||
*/
|
||||
for (k = G->num - 1; k >= 0; k--)
|
||||
{
|
||||
x->n = nmod_mul(x->n, G->generators[k], G->mod);
|
||||
x->log[k]++;
|
||||
if (x->log[k] % G->P[k].p == 0)
|
||||
{
|
||||
x->n = nmod_mul(x->n, G->generators[k], G->mod);
|
||||
x->log[k]++;
|
||||
if (k > 0 || G->neven != 2)
|
||||
{
|
||||
x->n = nmod_mul(x->n, G->generators[k], G->mod);
|
||||
x->log[k]++;
|
||||
}
|
||||
}
|
||||
if (x->log[k] < G->P[k].phi)
|
||||
break;
|
||||
|
|
|
@ -32,7 +32,7 @@ acb_dirichlet_dft_conrey(acb_ptr w, acb_srcptr v, const acb_dirichlet_group_t G,
|
|||
slong k, l, * cyc;
|
||||
cyc = flint_malloc(G->num * sizeof(slong));
|
||||
for (k = 0, l = G->num - 1; l >= 0; k++, l--)
|
||||
cyc[k] = G->P[l].phi;
|
||||
cyc[k] = G->P[k].phi;
|
||||
|
||||
acb_dirichlet_dft_prod(w, v, cyc, G->num, prec);
|
||||
flint_free(cyc);
|
||||
|
|
|
@ -33,7 +33,7 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
|
|||
xz = _acb_vec_init(chi->order.n);
|
||||
_acb_vec_set_powers(xz, z, chi->order.n, prec);
|
||||
|
||||
while (1) {
|
||||
do {
|
||||
chin = acb_dirichlet_ui_chi_conrey(G, chi, cn);
|
||||
|
||||
acb_set_ui(a, cn->n);
|
||||
|
@ -42,9 +42,7 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
|
|||
|
||||
acb_addmul(t, xz + chin, u, prec);
|
||||
|
||||
if (acb_dirichlet_conrey_next(cn, G) == G->num)
|
||||
break;
|
||||
}
|
||||
} while (acb_dirichlet_conrey_next(cn, G) >= 0);
|
||||
|
||||
acb_set_ui(u, G->q);
|
||||
acb_neg(a, s);
|
||||
|
|
|
@ -43,17 +43,15 @@ acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s,
|
|||
|
||||
zeta = z = _acb_vec_init(G->phi_q);
|
||||
acb_dirichlet_conrey_one(cn, G);
|
||||
while (1) {
|
||||
do {
|
||||
|
||||
acb_set_ui(a, cn->n);
|
||||
acb_div_ui(a, a, G->q, prec);
|
||||
acb_hurwitz_zeta(z, s, a, prec);
|
||||
acb_mul(z, z, qs, prec);
|
||||
|
||||
if (acb_dirichlet_conrey_next(cn, G) == G->num)
|
||||
break;
|
||||
z++;
|
||||
}
|
||||
} while (acb_dirichlet_conrey_next(cn, G) >= 0);
|
||||
|
||||
acb_dirichlet_dft_conrey(res, zeta, G, prec);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ int main()
|
|||
acb_dirichlet_conrey_one(x, G);
|
||||
n++;
|
||||
|
||||
for (; acb_dirichlet_conrey_next(x, G) < G->num; n++);
|
||||
for (; acb_dirichlet_conrey_next(x, G) >= 0; n++);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
acb_dirichlet_group_clear(G);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ int main()
|
|||
acb_dirichlet_char_one(chi, G);
|
||||
n++;
|
||||
|
||||
for (; acb_dirichlet_char_next(chi, G) < G->num; n++);
|
||||
for (; acb_dirichlet_char_next(chi, G) >= 0; n++);
|
||||
acb_dirichlet_char_clear(chi);
|
||||
acb_dirichlet_group_clear(G);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ int main()
|
|||
sum = 1;
|
||||
|
||||
#if 1
|
||||
for (n = 1; acb_dirichlet_conrey_next(x, G) < G->num; n++)
|
||||
for (n = 1; acb_dirichlet_conrey_next(x, G) >= 0; n++)
|
||||
sum += x->n * x->n;
|
||||
#else
|
||||
/* iteration much faster than gcd below */
|
||||
|
@ -71,12 +71,10 @@ int main()
|
|||
/* use http://oeis.org/A053818 to check all elements
|
||||
* are gone through */
|
||||
ref = (q % 4 == 2) ? -2 : 1;
|
||||
k = (G->neven == 2) ? 1 : 0;
|
||||
for (; k<G->num; k++)
|
||||
for (k = (G->neven == 2); k < G->num; k++)
|
||||
ref = - ref * G->P[k].p;
|
||||
ref = ( G->phi_q * (2 * q * q + ref) ) / 6;
|
||||
|
||||
|
||||
if (n != G->phi_q)
|
||||
{
|
||||
flint_printf("FAIL: group size\n\n");
|
||||
|
@ -98,7 +96,7 @@ int main()
|
|||
continue;
|
||||
|
||||
acb_dirichlet_conrey_first_primitive(x, G);
|
||||
for (n = 1; (k=acb_dirichlet_conrey_next_primitive(x, G)) < G->num; n++);
|
||||
for (n = 1; acb_dirichlet_conrey_next_primitive(x, G) >= 0; n++);
|
||||
|
||||
ref = acb_dirichlet_number_primitive(G);
|
||||
if (n != ref)
|
||||
|
|
|
@ -81,7 +81,7 @@ int main()
|
|||
abort();
|
||||
}
|
||||
|
||||
if (acb_dirichlet_conrey_next(x, G) == G->num)
|
||||
if (acb_dirichlet_conrey_next(x, G) < 0)
|
||||
break;
|
||||
}
|
||||
acb_clear(s1);
|
||||
|
|
|
@ -35,7 +35,7 @@ int main()
|
|||
|
||||
/* check Jacobi sums */
|
||||
|
||||
for (q = 29*29; q > 1; q = q%2 ? 3*q+1 : q/2)
|
||||
for (q = 29 * 29; q > 1; q = q%2 ? 3*q+1 : q/2)
|
||||
{
|
||||
slong m1, m2;
|
||||
acb_dirichlet_group_t G;
|
||||
|
@ -78,12 +78,12 @@ int main()
|
|||
);
|
||||
abort();
|
||||
}
|
||||
if (acb_dirichlet_char_next(chi2, G) == G->num)
|
||||
if (acb_dirichlet_char_next(chi2, G) < 0)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (acb_dirichlet_char_next(chi1, G) == G->num)
|
||||
if (acb_dirichlet_char_next(chi1, G) < 0)
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ test_dft()
|
|||
|
||||
i = 0;
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
while (1) {
|
||||
do {
|
||||
|
||||
acb_dirichlet_char_conrey(chi, G, x);
|
||||
acb_dirichlet_l_hurwitz(z, s, G, chi, prec);
|
||||
|
@ -73,10 +73,8 @@ test_dft()
|
|||
flint_printf("\n\n");
|
||||
}
|
||||
|
||||
if (acb_dirichlet_conrey_next(x, G) == G->num)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
} while (acb_dirichlet_conrey_next(x, G) >= 0);
|
||||
|
||||
acb_clear(s);
|
||||
_acb_vec_clear(v, G->phi_q);
|
||||
|
|
|
@ -84,7 +84,7 @@ int main()
|
|||
acb_init(sum);
|
||||
acb_dirichlet_char_first_primitive(chi, G);
|
||||
|
||||
while (1) {
|
||||
do {
|
||||
ulong m;
|
||||
acb_zero(sum);
|
||||
|
||||
|
@ -119,10 +119,8 @@ int main()
|
|||
flint_printf("\n");
|
||||
abort();
|
||||
}
|
||||
} while (acb_dirichlet_char_next_primitive(chi, G) >= 0);
|
||||
|
||||
if (acb_dirichlet_char_next_primitive(chi, G) == G->num)
|
||||
break;
|
||||
}
|
||||
_acb_vec_clear(z, G->expo);
|
||||
_arb_vec_clear(t, nv);
|
||||
acb_clear(zeta);
|
||||
|
|
|
@ -59,7 +59,7 @@ int main()
|
|||
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
|
||||
while (1) {
|
||||
do {
|
||||
|
||||
acb_dirichlet_char_conrey(chi, G, x);
|
||||
|
||||
|
@ -73,9 +73,7 @@ int main()
|
|||
abort();
|
||||
}
|
||||
|
||||
if (acb_dirichlet_conrey_next(x, G) == G->num)
|
||||
break;
|
||||
}
|
||||
} while (acb_dirichlet_conrey_next(x, G) >= 0);
|
||||
|
||||
flint_free(v1);
|
||||
flint_free(v2);
|
||||
|
|
|
@ -41,10 +41,10 @@ acb_dirichlet_ui_chi_vec_loop(ulong *v, const acb_dirichlet_group_t G, const acb
|
|||
|
||||
t = v[1] = 0;
|
||||
|
||||
while ( (j = acb_dirichlet_conrey_next(x, G)) < G->num )
|
||||
while ( (j = acb_dirichlet_conrey_next(x, G)) >= 0 )
|
||||
{
|
||||
/* exponents were modified up to j */
|
||||
for (k = 0; k <= j; k++)
|
||||
for (k = G->num - 1; k >= j; k--)
|
||||
t = nmod_add(t, chi->expo[k], chi->order);
|
||||
|
||||
if (x->n < nv)
|
||||
|
|
Loading…
Add table
Reference in a new issue