arb/acb_dirichlet/powers_init.c

66 lines
2 KiB
C
Raw Normal View History

2016-04-12 15:07:04 +02:00
/*=============================================================================
This file is part of ARB.
ARB is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
ARB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ARB; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=============================================================================*/
/******************************************************************************
Copyright (C) 2016 Pascal Molin
******************************************************************************/
#include "acb_dirichlet.h"
#include "acb_poly.h"
void
2016-07-22 16:23:09 +02:00
_acb_dirichlet_powers_init(acb_dirichlet_powers_t t, ulong order, slong size, slong depth, slong prec)
2016-04-12 15:07:04 +02:00
{
2016-07-22 16:23:09 +02:00
slong k;
2016-04-12 15:07:04 +02:00
t->order = order;
2016-07-22 16:23:09 +02:00
acb_init(t->z);
acb_dirichlet_nth_root(t->z, order, prec);
t->size = size;
t->depth = depth;
if (depth)
2016-04-12 15:07:04 +02:00
{
2016-07-22 16:23:09 +02:00
acb_struct * z;
z = t->z + 0;
t->Z = flint_malloc(depth * sizeof(acb_ptr));
for (k = 0; k < depth; k++)
{
t->Z[k] = _acb_vec_init(size);
_acb_vec_set_powers(t->Z[k], z, size, prec);
z = t->Z[k] + 1;
}
2016-04-12 15:07:04 +02:00
}
else
{
t->Z = NULL;
}
2016-07-22 16:23:09 +02:00
}
void
acb_dirichlet_powers_init(acb_dirichlet_powers_t t, ulong order, slong num, slong prec)
{
slong size, depth;
depth = (num > order) ? 1 : n_flog(order, num);
size = n_root(order, depth) + 1;
_acb_dirichlet_powers_init(t, order, size, depth, prec);
2016-04-12 15:07:04 +02:00
}