Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:15:06

0001 /*
0002     Copyright (C) 2013 Fredrik Johansson
0003 
0004     This file is part of FLINT.
0005 
0006     FLINT is free software: you can redistribute it and/or modify it under
0007     the terms of the GNU Lesser General Public License (LGPL) as published
0008     by the Free Software Foundation; either version 3 of the License, or
0009     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
0010 */
0011 
0012 #ifndef ARB_CALC_H
0013 #define ARB_CALC_H
0014 
0015 #include "arb.h"
0016 
0017 #ifdef __cplusplus
0018 extern "C" {
0019 #endif
0020 
0021 extern FLINT_TLS_PREFIX int arb_calc_verbose;
0022 
0023 typedef int (*arb_calc_func_t)(arb_ptr out,
0024     const arb_t inp, void * param, slong order, slong prec);
0025 
0026 #define ARB_CALC_SUCCESS 0
0027 #define ARB_CALC_IMPRECISE_INPUT 1
0028 #define ARB_CALC_NO_CONVERGENCE 2
0029 
0030 /* Root-finding */
0031 
0032 FLINT_FORCE_INLINE void
0033 arf_interval_init(arf_interval_t v)
0034 {
0035     arf_init(&v->a);
0036     arf_init(&v->b);
0037 }
0038 
0039 FLINT_FORCE_INLINE void
0040 arf_interval_clear(arf_interval_t v)
0041 {
0042     arf_clear(&v->a);
0043     arf_clear(&v->b);
0044 }
0045 
0046 FLINT_FORCE_INLINE arf_interval_ptr
0047 _arf_interval_vec_init(slong n)
0048 {
0049     slong i;
0050     arf_interval_ptr v = (arf_interval_ptr) flint_malloc(sizeof(arf_interval_struct) * n);
0051 
0052     for (i = 0; i < n; i++)
0053         arf_interval_init(v + i);
0054 
0055     return v;
0056 }
0057 
0058 FLINT_FORCE_INLINE void
0059 _arf_interval_vec_clear(arf_interval_ptr v, slong n)
0060 {
0061     slong i;
0062     for (i = 0; i < n; i++)
0063         arf_interval_clear(v + i);
0064     flint_free(v);
0065 }
0066 
0067 FLINT_FORCE_INLINE void
0068 arf_interval_set(arf_interval_t v, const arf_interval_t u)
0069 {
0070     arf_set(&v->a, &u->a);
0071     arf_set(&v->b, &u->b);
0072 }
0073 
0074 FLINT_FORCE_INLINE void
0075 arf_interval_swap(arf_interval_t v, arf_interval_t u)
0076 {
0077     arf_swap(&v->a, &u->a);
0078     arf_swap(&v->b, &u->b);
0079 }
0080 
0081 FLINT_FORCE_INLINE void
0082 arf_interval_get_arb(arb_t x, const arf_interval_t v, slong prec)
0083 {
0084     arb_set_interval_arf(x, &v->a, &v->b, prec);
0085 }
0086 
0087 #ifdef FLINT_HAVE_FILE
0088 void arf_interval_fprintd(FILE * file, const arf_interval_t v, slong n);
0089 #endif
0090 
0091 void arf_interval_printd(const arf_interval_t v, slong n);
0092 
0093 /* bisection */
0094 
0095 int arb_calc_partition(arf_interval_t L, arf_interval_t R,
0096     arb_calc_func_t func, void * param, const arf_interval_t block, slong prec);
0097 
0098 slong arb_calc_isolate_roots(arf_interval_ptr * found, int ** flags,
0099     arb_calc_func_t func, void * param,
0100     const arf_interval_t interval, slong maxdepth, slong maxeval, slong maxfound,
0101     slong prec);
0102 
0103 int arb_calc_refine_root_bisect(arf_interval_t r, arb_calc_func_t func,
0104     void * param, const arf_interval_t start, slong iter, slong prec);
0105 
0106 /* newton iteration */
0107 
0108 void arb_calc_newton_conv_factor(arf_t conv_factor,
0109     arb_calc_func_t func, void * param, const arb_t conv_region, slong prec);
0110 
0111 int arb_calc_newton_step(arb_t xnew, arb_calc_func_t func, void * param,
0112     const arb_t x, const arb_t conv_region, const arf_t conv_factor, slong prec);
0113 
0114 int arb_calc_refine_root_newton(arb_t r, arb_calc_func_t func,
0115     void * param, const arb_t start, const arb_t conv_region,
0116     const arf_t conv_factor, slong eval_extra_prec, slong prec);
0117 
0118 
0119 
0120 #ifdef __cplusplus
0121 }
0122 #endif
0123 
0124 #endif