FastPolyEval  1.0
Fast Evaluation of Real and Complex Polynomials
evalf.h
Go to the documentation of this file.
1 //
2 // evalf.h
3 //
4 // Authors: Nicolae Mihalache & François Vigneron
5 //
6 // This software is released under BSD licence, with an attribution clause (see Licence file).
7 // Please cite the reference below if you use or distribute this software.
8 //
9 // • [1] R. Anton, N. Mihalache & F. Vigneron. Fast evaluation of real and complex polynomials. 2022.
10 // https://hal.archives-ouvertes.fr/hal-03820369
11 //
12 // Copyright 2022 Univ. Paris-Est Créteil & Univ. de Reims Champagne-Ardenne.
13 //
14 
20 #ifndef evalf_h
21 #define evalf_h
22 
23 #include "ntypes.h"
24 #include "compf.h"
25 #include "concave.h"
26 #include "polyf.h"
27 #include "polyfr.h"
28 #include "powsf.h"
29 #include "powsfr.h"
30 
31 // MARK: data types
32 
35 typedef struct {
36  polyf P;
38  bool real;
46 } evalf_struct;
47 
51 typedef evalf_struct evalf_t[1];
52 
55 
56 // MARK: macros & functions prototypes
57 
59 #define evalf_lastValError(ev) (ev->valErr)
60 
62 #define evalf_lastDerError(ev) (ev->derErr)
63 
70 
77 
84 bool evalf_free(evalf ev);
85 
96 bool evalf_val(compf v, evalf ev, compf z);
97 
108 bool evalf_der(compf d, evalf ev, compf z);
109 
122 bool evalf_val_der(compf v, compf d, evalf ev, compf z);
123 
135 bool evalf_newton(compf nt, evalf ev, compf z);
136 
137 // MARK: Bare-metal variants
138 
149 
160 
172 bool evalf_val_cc(compf v, evalf ev, compf z);
173 
185 bool evalf_der_cc(compf d, evalf ev, compf z);
186 
201 
215 
228 
241 
256 
270 
282 bool evalf_val_rc(compf v, evalf ev, compf z);
283 
295 bool evalf_der_rc(compf d, evalf ev, compf z);
296 
311 
325 
337 
349 
364 
377 
378 #endif /* evalf_h */
Definition of machine complex numbers.
compf_struct compf[1]
Practical wrapper for compf_struct.
Definition: compf.h:43
Definition of a concave function computed from the coefficients of some polynomial.
bool evalf_newton_cr(compf nt, evalf ev, coeff_t x)
Computes the Newthon method step of ev->P using the method described in [1].
evalf_struct evalf_t[1]
Practical wrapper for evalf_struct.
Definition: evalf.h:51
bool evalf_val_der_rr(coeff_t *v, coeff_t *d, evalf ev, coeff_t x)
Evaluates ev->Q(x) and ev->Q'(x) using the method described in [1].
bool evalf_val_der(compf v, compf d, evalf ev, compf z)
Evaluates ev->P(z) and ev->P'(z) (or ev->Q(z) and ev->Q'(z)) using the method described in [1].
coeff_t evalf_val_rr(evalf ev, coeff_t x)
Evaluates the real polynomial ev->Q(x) using the method described in [1].
coeff_t evalf_newton_rr(evalf ev, coeff_t x)
Computes the Newthon method step of the real polynomial ev->Q using the method described in [1].
bool evalf_val_der_cc(compf v, compf d, evalf ev, compf z)
Evaluates ev->P(x) and ev->P'(x) using the method described in [1].
bool evalf_val(compf v, evalf ev, compf z)
Evaluates ev->P(z) (or ev->Q(z)) using the method described in [1].
bool evalf_free(evalf ev)
Frees all the memory used by the evaluator ev, assuming the struct has been allocated with malloc(),...
bool evalf_val_der_rc(compf v, compf d, evalf ev, compf z)
Evaluates ev->Q(x) and ev->Q'(x) using the method described in [1].
bool evalf_val_cc(compf v, evalf ev, compf z)
Evaluates ev->P(x) using the method described in [1].
bool evalf_newton_cc(compf nt, evalf ev, compf z)
Computes the Newthon method step of ev->P using the method described in [1].
bool evalf_newton_rc(compf nt, evalf ev, compf z)
Computes the Newthon method step of ev->Q using the method described in [1].
bool evalf_val_cr(compf v, evalf ev, coeff_t x)
Evaluates ev->P(x) using the method described in [1].
bool evalf_analyse_r(evalf ev)
Analyses the real polynomial ev->Q, after some of its coefficients have been changed.
evalf_struct * evalf
Convenience pointer to evalf_struct.
Definition: evalf.h:54
bool evalf_der_cr(compf d, evalf ev, coeff_t x)
Evaluates ev->P'(x) using the method described in [1].
bool evalf_analyse(evalf ev)
Analyses the complex polynomial ev->P, after some of its coefficients have been changed.
bool evalf_der(compf d, evalf ev, compf z)
Evaluates ev->P'(z) (or ev->Q'(z)) using the method described in [1].
bool evalf_der_rc(compf d, evalf ev, compf z)
Evaluates ev->Q'(x) using the method described in [1].
coeff_t evalf_der_rr(evalf ev, coeff_t x)
Evaluates the derivative of real polynomial ev->Q'(x) using the method described in [1].
bool evalf_der_cc(compf d, evalf ev, compf z)
Evaluates ev->P'(x) using the method described in [1].
evalf evalf_new_r(polyfr Q)
Returns a new evaluator of the real polynomial Q.
bool evalf_val_der_cr(compf v, compf d, evalf ev, coeff_t x)
Evaluates ev->P(x) and ev->P'(x) using the method described in [1].
evalf evalf_new(polyf P)
Returns a new evaluator of the complex polynomial P.
bool evalf_newton(compf nt, evalf ev, compf z)
Computes the Newthon method step of ev->P (or ev->Q) using the method described in [1].
bool evalf_val_rc(compf v, evalf ev, compf z)
Evaluates ev->Q(x) using the method described in [1].
Definition of basic types.
double real_t
The machine number type to use for polynomial analysis and preconditionning.
Definition: ntypes.h:163
double coeff_t
The machine number type to use for polynomial coefficients and evaluation.
Definition: ntypes.h:81
ulong deg_t
The integer number type to use for polynomial degrees and indexes.
Definition: ntypes.h:128
Definition of complex polynomials with machine floating point coefficients.
Definition of real polynomials with machine floating point coefficients.
Definition of a buffer for pre-computed powers of a machine complex number.
Definition of a buffer for pre-computed powers of a machine real number.
Description of a concave function computed from the coefficients of some polynomial.
Definition: concave.h:35
Evaluator of polynomials with machine floating point coefficients.
Definition: evalf.h:35
polyfr Q
the polynomial, with real coefficients
Definition: evalf.h:37
concave f
concave cover of the magnitude of coefficients
Definition: evalf.h:39
powsf zn
powers of a complex argument
Definition: evalf.h:40
real_t derErr
the [approximative] upper bound for the absolute error of the last derivative evaluation,...
Definition: evalf.h:43
polyf P
the polynomial, with complex coefficients
Definition: evalf.h:36
bool real
the type of polynomial to evaluate
Definition: evalf.h:38
real_t ntErr
the [approximative] upper bound for the absolute error of the last Newton term evaluation,...
Definition: evalf.h:44
deg_t terms
the number of polynomial terms computed by the last operation
Definition: evalf.h:45
powsfr xn
powers of a real argument
Definition: evalf.h:41
real_t valErr
the [approximative] upper bound for the absolute error of the last evaluation, in bits
Definition: evalf.h:42
Polynomial with machine floating point complex coefficients.
Definition: polyf.h:30
Polynomial with machine floating point real coefficients.
Definition: polyfr.h:31
The powers of the complex number z using machine floating point numbers.
Definition: powsf.h:30
The powers of the real number x using machine floating point numbers.
Definition: powsfr.h:35