2013-05-17 19:22:38 +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) 2013 Fredrik Johansson
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef ELEFUN_H
|
|
|
|
#define ELEFUN_H
|
|
|
|
|
|
|
|
#include "fmprb.h"
|
2013-05-22 17:05:58 +02:00
|
|
|
#include "fmpz_extras.h"
|
|
|
|
|
2013-09-17 18:55:23 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
#endif
|
|
|
|
|
2013-05-22 17:05:58 +02:00
|
|
|
static __inline__ void
|
|
|
|
fmpz_print_fixed(const fmpz_t x, long prec)
|
|
|
|
{
|
|
|
|
fmpr_t t;
|
|
|
|
fmpr_init(t);
|
|
|
|
fmpr_set_fmpz(t, x);
|
|
|
|
fmpr_mul_2exp_si(t, t, -prec);
|
|
|
|
fmpr_printd(t, prec / 3.33);
|
|
|
|
fmpr_clear(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EXP_CACHE_PREC 1024
|
|
|
|
#define EXP_CACHE_BITS 8
|
|
|
|
#define EXP_CACHE_NUM (1L<<EXP_CACHE_BITS)
|
|
|
|
#define EXP_CACHE_LEVELS 2
|
|
|
|
#define EXP_CACHE_REDUCTION (EXP_CACHE_LEVELS * EXP_CACHE_BITS)
|
2013-05-17 19:22:38 +02:00
|
|
|
|
|
|
|
long elefun_exp_taylor_bound(long mag, long prec);
|
|
|
|
|
|
|
|
void elefun_exp_fixed_taylor_horner_precomp(fmpz_t y, fmpz_t yerr, const fmpz_t x, long n, long prec);
|
|
|
|
|
2013-05-22 17:05:58 +02:00
|
|
|
void elefun_exp_fixed_precomp(fmpz_t y, fmpz_t yerr, fmpz_t exponent,
|
|
|
|
const fmpz_t x, const fmpz_t xerr, long prec);
|
|
|
|
|
|
|
|
int elefun_exp_precomp(fmprb_t z, const fmprb_t x, long prec, int minus_one);
|
|
|
|
|
2013-05-29 11:35:59 +02:00
|
|
|
void elefun_exp_via_mpfr(fmprb_t z, const fmprb_t x, long prec);
|
|
|
|
|
2014-02-23 16:04:36 +01:00
|
|
|
void elefun_exp_sum_bs_powtab(fmpz_t T, fmpz_t Q, mp_bitcnt_t * Qexp,
|
|
|
|
const fmpz_t x, mp_bitcnt_t r, long N);
|
|
|
|
|
|
|
|
void elefun_exp_sum_bs_simple(fmpz_t T, fmpz_t Q, mp_bitcnt_t * Qexp,
|
|
|
|
const fmpz_t x, mp_bitcnt_t r, long N);
|
|
|
|
|
2014-02-23 17:55:53 +01:00
|
|
|
void elefun_exp_fmpr_bb(fmprb_t z, const fmpr_t x, long prec, int m1);
|
2014-02-23 16:04:36 +01:00
|
|
|
|
2013-05-31 17:33:12 +02:00
|
|
|
|
2013-09-17 18:55:23 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-17 19:22:38 +02:00
|
|
|
#endif
|
|
|
|
|