FastPolyEval  1.0
Fast Evaluation of Real and Complex Polynomials
powsfr.h
Go to the documentation of this file.
1 //
2 // powsfr.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 powsfr_h
21 #define powsfr_h
22 
23 #include "ntypes.h"
24 
25 // MARK: data types
26 
27 // comment this line to use repeated squares method and buffers to compute powers of @c x
28 // leave uncommented tu use a direct computation with @c pow() or @c powl()
29 #define POWSFR_DIRECT_POWERS
30 
31 #ifdef POWSFR_DIRECT_POWERS
32 
35 typedef struct {
36  bool inited;
39 
40 #else
41 
44 typedef struct {
45  deg_t size;
46  byte tps;
47  bool *computed;
48  coeff_t *xn;
50 
51 #endif
52 
57 
60 
61 // MARK: macros & functions prototypes
62 
71 
79 
87 
98 
108 
109 #endif /* powsfr_h */
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
coeff_t powsfr_pow_once(powsfr xn, deg_t pow)
Computes x^pow using repeated squares method and the cache of previously computed powers.
bool powsfr_free(powsfr xn)
Frees all the memory used by the buffer xn, assuming the struct has been allocated with malloc(),...
coeff_t powsfr_pow(powsfr xn, deg_t pow)
Computes x^pow using repeated squares method and the cache of previously computed powers.
bool powsfr_set(powsfr xn, coeff_t x)
Sets the real number of which the powers will be computed by the buffer xn.
powsfr powsfr_new(deg_t size)
Returns a new buffer of powers of machine real numbers, with initial storage space for size powers.
powsfr_struct * powsfr
Convenience pointer to eval_struct.
Definition: powsfr.h:59
powsfr_struct powsfr_t[1]
Practical wrapper for powsfr_struct.
Definition: powsfr.h:56
The powers of the real number x using machine floating point numbers.
Definition: powsfr.h:35
coeff_t x
the real number
Definition: powsfr.h:37
bool inited
the status of the value x
Definition: powsfr.h:36