mirror of
https://github.com/vale981/arb
synced 2025-03-05 09:21:38 -05:00
add explicit group_dlog_clear
using subgroup and clearing it would have corrupted the dlog pointers
This commit is contained in:
parent
3a9dc880e5
commit
387db2b9b4
5 changed files with 31 additions and 15 deletions
|
@ -72,6 +72,7 @@ void acb_dirichlet_group_init(acb_dirichlet_group_t G, ulong q);
|
|||
void acb_dirichlet_subgroup_init(acb_dirichlet_group_t H, const acb_dirichlet_group_t G, ulong h);
|
||||
void acb_dirichlet_group_clear(acb_dirichlet_group_t G);
|
||||
void acb_dirichlet_group_dlog_precompute(acb_dirichlet_group_t G, ulong num);
|
||||
void acb_dirichlet_group_dlog_clear(acb_dirichlet_group_t G);
|
||||
|
||||
/* properties of elements without log */
|
||||
|
||||
|
|
|
@ -15,17 +15,6 @@
|
|||
void
|
||||
acb_dirichlet_group_clear(acb_dirichlet_group_t G)
|
||||
{
|
||||
slong k;
|
||||
|
||||
for (k = 0; k < G->num; k++)
|
||||
{
|
||||
if (G->P[k].dlog != NULL)
|
||||
{
|
||||
dlog_precomp_clear(G->P[k].dlog);
|
||||
flint_free(G->P[k].dlog);
|
||||
}
|
||||
}
|
||||
|
||||
flint_free(G->P);
|
||||
flint_free(G->generators);
|
||||
flint_free(G->PHI);
|
||||
|
|
|
@ -18,11 +18,28 @@ acb_dirichlet_prime_group_dlog_precompute(acb_dirichlet_prime_group_struct * P,
|
|||
dlog_precomp_modpe_init(P->dlog, P->g, P->p, P->e, P->pe.n, num);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
acb_dirichlet_group_dlog_precompute(acb_dirichlet_group_t G, ulong num)
|
||||
{
|
||||
slong k;
|
||||
for (k = 0; k < G->num; k++)
|
||||
acb_dirichlet_prime_group_dlog_precompute(&G->P[k], num);
|
||||
{
|
||||
if (G->P[k].dlog == NULL)
|
||||
acb_dirichlet_prime_group_dlog_precompute(&G->P[k], num);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_group_dlog_clear(acb_dirichlet_group_t G)
|
||||
{
|
||||
slong k;
|
||||
for (k = 0; k < G->num; k++)
|
||||
{
|
||||
if (G->P[k].dlog != NULL)
|
||||
{
|
||||
dlog_precomp_clear(G->P[k].dlog);
|
||||
flint_free(G->P[k].dlog);
|
||||
G->P[k].dlog = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,6 +140,8 @@ int main()
|
|||
|
||||
}
|
||||
|
||||
acb_dirichlet_group_dlog_clear(G);
|
||||
|
||||
acb_dirichlet_char_clear(chi);
|
||||
acb_dirichlet_char_clear(chi2);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
|
|
|
@ -76,11 +76,12 @@ logarithms.
|
|||
.. function:: void acb_dirichlet_subgroup_init(acb_dirichlet_group_t H, const acb_dirichlet_group_t G, ulong h)
|
||||
|
||||
Given an already computed group *G* mod `q`, initialize its subgroup *H*
|
||||
defined mod `h\mid q`. Precomputed discrete log tables are kept.
|
||||
defined mod `h\mid q`. Precomputed discrete log tables are inherited.
|
||||
|
||||
.. function:: void acb_dirichlet_group_clear(acb_dirichlet_group_t G)
|
||||
|
||||
Clears *G*.
|
||||
Clears *G*. Remark this function does *not* clear the discrete logarithm
|
||||
tables stored in *G* (which may be shared with another group).
|
||||
|
||||
.. function:: void acb_dirichlet_group_dlog_precompute(acb_dirichlet_group_t G, ulong num)
|
||||
|
||||
|
@ -89,6 +90,12 @@ logarithms.
|
|||
|
||||
If *num* gets very large, the entire group may be indexed.
|
||||
|
||||
.. function:: void acb_dirichlet_group_dlog_clear(acb_dirichlet_group_t G, ulong num)
|
||||
|
||||
Clear discrete logarithm tables in *G*. When discrete logarithm tables are
|
||||
shared with subgroups, those subgroups must be cleared before clearing the
|
||||
tables.
|
||||
|
||||
Conrey elements
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue