arb/zeta/ui_vec.c

51 lines
1.8 KiB
C
Raw Normal View History

2012-09-03 16:32:26 +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
=============================================================================*/
/******************************************************************************
2013-03-27 15:54:05 +01:00
Copyright (C) 2012, 2013 Fredrik Johansson
2012-09-03 16:32:26 +02:00
******************************************************************************/
#include "zeta.h"
2012-09-03 16:32:26 +02:00
void
zeta_ui_vec(fmprb_ptr x, ulong start, long num, long prec)
2012-09-03 16:32:26 +02:00
{
2013-03-27 15:54:05 +01:00
long i, num_odd, num_even, start_odd;
fmprb_ptr tmp;
2012-09-03 16:32:26 +02:00
2013-03-27 15:54:05 +01:00
num_odd = num / 2 + (start & num & 1);
num_even = num - num_odd;
2012-09-03 16:32:26 +02:00
2013-03-27 15:54:05 +01:00
start_odd = start % 2;
2012-09-03 16:32:26 +02:00
2013-03-27 15:54:05 +01:00
zeta_ui_vec_even(x, start + start_odd, num_even, prec);
zeta_ui_vec_odd(x + num_even, start + !start_odd, num_odd, prec);
2012-09-03 16:32:26 +02:00
2013-03-27 15:54:05 +01:00
/* interleave */
tmp = flint_malloc(sizeof(fmprb_struct) * num);
for (i = 0; i < num_even; i++) tmp[i] = x[i];
for (i = 0; i < num_odd; i++) tmp[num_even + i] = x[num_even + i];
for (i = 0; i < num_even; i++) x[start_odd + 2 * i] = tmp[i];
for (i = 0; i < num_odd; i++) x[!start_odd + 2 * i] = tmp[num_even + i];
flint_free(tmp);
2012-09-03 16:32:26 +02:00
}
2013-03-27 15:54:05 +01:00