Skip to content

Commit

Permalink
Attempt at ql_all_new
Browse files Browse the repository at this point in the history
  • Loading branch information
j-kieffer committed Aug 29, 2024
1 parent 6f5bc44 commit e7f12c5
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/acb_theta.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ void acb_theta_ql_steps(acb_ptr th, acb_ptr th_init, acb_srcptr rts,
slong g, slong prec);
int acb_theta_ql_exact(acb_ptr th, acb_srcptr zs, slong nb, const acb_mat_t tau,
int all, int shifted_prec, slong prec);
int acb_theta_ql_all_new(acb_ptr th, acb_srcptr zs, slong nb, const acb_mat_t tau,
int sqr, slong prec);

/* Main functions */

Expand Down
88 changes: 88 additions & 0 deletions src/acb_theta/ql_all_new.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
Copyright (C) 2024 Jean Kieffer
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "acb.h"
#include "acb_mat.h"
#include "acb_theta.h"

int
acb_theta_ql_all_new(acb_ptr th, acb_srcptr zs, slong nb, const acb_mat_t tau,
int sqr, slong prec)
{
slong g = acb_mat_nrows(tau);
slong n = 1 << g;
acb_mat_t new_tau;
acb_ptr new_z, new_th;
slong j, k;
int add_zero = 0;
int res;

if (nb <= 0)
{
return 1;
}
else if (!_acb_vec_is_zero(zs, g))
{
add_zero = 1;
}

acb_mat_init(new_tau, g, g);
new_z = _acb_vec_init((nb + add_zero) * g);

/* Strip tau, z of error bounds */
for (j = 0; j < g; j++)
{
for (k = j; k < g; k++)
{
acb_get_mid(acb_mat_entry(new_tau, j, k), acb_mat_entry(tau, j, k));
acb_set(acb_mat_entry(new_tau, k, j), acb_mat_entry(new_tau, j, k));
}
}
for (j = 0; j < nb * g; j++)
{
acb_get_mid(&new_z[j], &zs[g * add_zero + j]);
}

/* Call ql_exact, with an extra duplication step if sqr is set */
if (sqr)
{
new_th = _acb_vec_init((nb + add_zero) * n);

/* Duplication */
acb_mat_scalar_mul_2exp_si(new_tau, new_tau, 1);
_acb_vec_scalar_mul_2exp_si(new_z, new_z, (nb + add_zero) * g, 1);
res = acb_theta_ql_exact(new_th, new_z, nb + add_zero, new_tau, 0, 0, prec);
if (res)
{

}
acb_mat_scalar_mul_2exp_si(new_tau, new_tau, -1);
_acb_vec_scalar_mul_2exp_si(new_z, new_z, (nb + add_zero) * g, 1);

_acb_vec_clear(new_th, (nb + add_zero) * n);
}
else
{
new_th = _acb_vec_init((nb + add_zero) * n * n);

res = acb_theta_ql_exact(new_th, new_z, nb + add_zero, tau, 1, 0, prec);
if (res)
{
_acb_vec_set(th, new_th + add_zero * n * n, nb * n * n);
}

_acb_vec_clear(new_th, (nb + add_zero) * n * n);
}

/* Add error bounds and clear */

return res;
}
2 changes: 1 addition & 1 deletion src/acb_theta/ql_exact.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2023 Jean Kieffer
Copyright (C) 2024 Jean Kieffer
This file is part of FLINT.
Expand Down

0 comments on commit e7f12c5

Please sign in to comment.