FastPolyEval  1.0
Fast Evaluation of Real and Complex Polynomials
polyf.h
Go to the documentation of this file.
1 //
2 // polyf.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 polyf_h
21 #define polyf_h
22 
23 #include "ntypes.h"
24 #include "compf.h"
25 
26 // MARK: data types
27 
30 typedef struct {
33  bool modified;
34 } polyf_struct;
35 
39 typedef polyf_struct polyf_t[1];
40 
43 
44 // MARK: functions prototypes
45 
52 
60 
67 bool polyf_free(polyf P);
68 
76 bool polyf_set(polyf P, compf coeff, deg_t ind);
77 
85 bool polyf_eval(compf res, polyf P, compf z);
86 
94 bool polyf_eval_r(compf res, polyf P, coeff_t x);
95 
102 
110 
118 
126 
133 
134 #endif /* polyf_h */
Definition of machine complex numbers.
compf_struct compf[1]
Practical wrapper for compf_struct.
Definition: compf.h:43
Definition of basic types.
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
polyf_struct polyf_t[1]
Practical wrapper for polyf_struct.
Definition: polyf.h:39
polyf polyf_diff(polyf P, polyf Q)
Computes P-Q.
bool polyf_eval_r(compf res, polyf P, coeff_t x)
Evaluates P(x) using Horner's method.
bool polyf_set(polyf P, compf coeff, deg_t ind)
Sets the coefficient of the polynomial P corresponding to the power ind to coeff.
polyf polyf_new(deg_t degree)
Returns a new complex polynomial of given degree, with machine floating point coefficients.
bool polyf_free(polyf P)
Frees all the memory used by the polynomial P, assuming the struct has been allocated with malloc(),...
polyf_struct * polyf
Convenience pointer to polyf_struct.
Definition: polyf.h:42
polyf polyf_from_roots(compf_ptr roots, deg_t degree)
Returns a new complex polynomial given the list of its roots, with machine floating point coefficient...
polyf polyf_sqr(polyf P)
Computes the square of P.
polyf polyf_prod(polyf P, polyf Q)
Computes P*Q.
polyf polyf_derivative(polyf P)
Computes the derivative of P.
polyf polyf_sum(polyf P, polyf Q)
Computes P+Q.
bool polyf_eval(compf res, polyf P, compf z)
Evaluates P(z) using Horner's method.
Machine complex numbers.
Definition: compf.h:29
Polynomial with machine floating point complex coefficients.
Definition: polyf.h:30
bool modified
the status of the coefficients
Definition: polyf.h:33
compf_ptr a
the coefficients
Definition: polyf.h:32
deg_t degree
the degree of the polynomial
Definition: polyf.h:31