2016-09-06 15:32:23 +02:00
|
|
|
/*
|
2016-03-23 12:53:08 +01:00
|
|
|
Copyright (C) 2016 Pascal Molin
|
|
|
|
|
2016-09-06 15:32:23 +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 Lesser General Public License (LGPL) as published
|
|
|
|
by the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2016-03-23 12:53:08 +01:00
|
|
|
|
2017-10-28 22:57:30 +02:00
|
|
|
#include "acb.h"
|
2016-03-23 12:53:08 +01:00
|
|
|
|
2016-04-12 15:07:04 +02:00
|
|
|
static void
|
2016-12-01 21:53:02 +01:00
|
|
|
_acb_unit_root(acb_t res, ulong order, slong prec)
|
2016-03-23 12:53:08 +01:00
|
|
|
{
|
|
|
|
fmpq_t t;
|
|
|
|
fmpq_init(t);
|
|
|
|
fmpq_set_si(t, 2, order);
|
|
|
|
arb_sin_cos_pi_fmpq(acb_imagref(res), acb_realref(res), t, prec);
|
|
|
|
fmpq_clear(t);
|
|
|
|
}
|
2016-04-12 15:07:04 +02:00
|
|
|
|
|
|
|
void
|
2016-12-01 21:53:02 +01:00
|
|
|
acb_unit_root(acb_t res, ulong order, slong prec)
|
2016-04-12 15:07:04 +02:00
|
|
|
{
|
|
|
|
switch (order)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
acb_one(res);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
acb_set_si(res, -1);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
acb_onei(res);
|
|
|
|
break;
|
|
|
|
default:
|
2016-12-01 21:53:02 +01:00
|
|
|
_acb_unit_root(res, order, prec);
|
2016-04-12 15:07:04 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|