FastPolyEval  1.0
Fast Evaluation of Real and Complex Polynomials
list.h
Go to the documentation of this file.
1 //
2 // list.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 list_h
21 #define list_h
22 
23 #include "ntypes.h"
24 
26 #define LIST_FACTOR 1.2
27 
29 #define LIST_TERM 100
30 
31  // MARK: data types
32 
35  typedef struct {
38  deg_t *k;
39  real_t *s;
40  bool sorted;
41  } list_struct;
42 
46  typedef list_struct list_t[1];
47 
49  typedef list_struct *list;
50 
51  // MARK: macros & functions prototypes
52 
59 
66 bool list_init(list l, deg_t size);
67 
74 bool list_free(list l);
75 
81 bool list_clear(list l);
82 
89 
97 bool list_add(list l, deg_t k, real_t s);
98 
104 bool list_trim(list l);
105 
114 bool list_sort(list l);
115 
116 #endif /* list_h */
bool list_free(list l)
Frees all the memory used by the list l, assuming the struct has been allocated with malloc(),...
bool list_add(list l, deg_t k, real_t s)
Adds the couple (k,s) at a new position at the end of the list l.
bool list_trim(list l)
Trims the list l to minimal size to contain all its elements.
bool list_init(list l, deg_t size)
Initializes an existing list l with storage space for size numbers.
list_struct list_t[1]
Practical wrapper for list_struct.
Definition: list.h:46
list list_new(deg_t size)
Returns a new list of machine real numbers, with storage space for size numbers.
list list_clone(list l)
Returns a copy of the list l.
bool list_clear(list l)
Frees all the memory used by the list l, but not the list l itself.
bool list_sort(list l)
Sorts the list in descending order while preserving couples (k[i],s[i]) for all i.
list_struct * list
Convenience pointer to list_struct.
Definition: list.h:49
Definition of basic types.
double real_t
The machine number type to use for polynomial analysis and preconditionning.
Definition: ntypes.h:163
ulong deg_t
The integer number type to use for polynomial degrees and indexes.
Definition: ntypes.h:128
A list of real numbers that can be sorted, while keeping track of original order.
Definition: list.h:35
deg_t count
the number of elements
Definition: list.h:37
deg_t * k
indexes, powers, the permutation of the numbers when sorted
Definition: list.h:38
real_t * s
the list of numbers
Definition: list.h:39
deg_t size
the memory size allocated
Definition: list.h:36
bool sorted
the state of the list
Definition: list.h:40