FastPolyEval  1.0
Fast Evaluation of Real and Complex Polynomials
pows.h
Go to the documentation of this file.
1 //
2 // pows.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 pows_h
21 #define pows_h
22 
23 #include "ntypes.h"
24 #include "comp.h"
25 
26 // MARK: data types
27 
30 typedef struct {
33  byte tps;
34  bool *computed;
36  mpfr_t buf1;
37  mpfr_t buf2;
40 } pows_struct;
41 
45 typedef pows_struct pows_t[1];
46 
48 typedef pows_struct *pows;
49 
50 // MARK: functions prototypes
51 
61 pows pows_new(prec_t prec, deg_t size);
62 
69 bool pows_free(pows zn);
70 
77 bool pows_set(pows zn, comp z);
78 
89 
99 
100 #endif /* pows_h */
Definition of MPFR complex numbers.
comp_struct comp[1]
Practical wrapper for comp_struct.
Definition: comp.h:39
Definition of basic types.
ulong deg_t
The integer number type to use for polynomial degrees and indexes.
Definition: ntypes.h:128
ulong prec_t
The integer number type to use for polynomial degrees and indexes.
Definition: ntypes.h:188
bool pows_free(pows zn)
Frees all the memory used by the buffer zn, assuming the struct has been allocated with malloc(),...
pows_struct pows_t[1]
Practical wrapper for pows_struct.
Definition: pows.h:45
bool pows_set(pows zn, comp z)
Sets the complex number of which the powers will be computed by the buffer zn.
pows_struct * pows
Convenience pointer to eval_struct.
Definition: pows.h:48
comp_ptr pows_pow_once(pows zn, deg_t pow)
Computes z^pow using repeated squares method and the cache of previously computed powers.
pows pows_new(prec_t prec, deg_t size)
Returns a new buffer of powers of complex numbers of precision prec, with initial storage space for s...
comp_ptr pows_pow(pows zn, deg_t pow)
Computes z^pow using repeated squares method and the cache of previously computed powers.
Multi-precision floating point complex numbers.
Definition: comp.h:31
The powers of the complex number z using multi-precision floating point numbers.
Definition: pows.h:30
prec_t prec
the precision of the powers of z, in bits
Definition: pows.h:31
comp res
another buffer
Definition: pows.h:39
mpfr_t buf2
another buffer
Definition: pows.h:37
bool * computed
the status of powers
Definition: pows.h:34
comp pth
a buffer
Definition: pows.h:38
mpfr_t buf1
a buffer
Definition: pows.h:36
comp_ptr zn
the powers of z
Definition: pows.h:35
deg_t size
the memory size allocated
Definition: pows.h:32
byte tps
the largest non-negative integer such that 2^tps<=size
Definition: pows.h:33