FastPolyEval  1.0
Fast Evaluation of Real and Complex Polynomials
arrayf.h
Go to the documentation of this file.
1 //
2 // arrayf.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 arrayf_h
21 #define arrayf_h
22 
23 #include <stdio.h>
24 #include <stdlib.h>
25 
26 #include "ntypes.h"
27 #include "compf.h"
28 #include "polyf.h"
29 #include "polyfr.h"
30 
31 // MARK: constants & data types
32 
33 #define LISTF_MIN_SIZE 100
34 #define LISTF_SIZE_INCREASE 1.25
35 
38 typedef struct {
43 
48 
51 
52 // MARK: functions prototypes
53 
60 
67 
74 
82 
90 bool arrayf_add(arrayf l, compf z);
91 
99 
106 
113 
120 
127 
134 
135 // MARK: IO operations
136 
144 bool arrayf_write(arrayf l, char *fileName, bool verbose);
145 
153 bool arrayf_append(arrayf l, char *fileName, bool verbose);
154 
161 arrayf arrayf_read(char *fileName, bool verbose);
162 
163 #endif /* arrayf_h */
compf_ptr arrayf_get(arrayf l, ulong pos)
Returns the pointer of the element on position pos in the list l.
bool arrayf_write(arrayf l, char *fileName, bool verbose)
Writes the list l to a CSV file with the given path fileName.
arrayf arrayf_read(char *fileName, bool verbose)
Reads a list of complex numbers from the CSV file with path fileName.
bool arrayf_add(arrayf l, compf z)
Adds the complex number z at the end of the list. The size of the list is automatically increased,...
polyfr arrayf_polyfr(arrayf l)
Returns the real polynomial with the coefficients the real parts of the complex numbers in the list l...
bool arrayf_is_real(arrayf l)
Checks if all complex numbers in the list l are real.
arrayf_struct arrayf_t[1]
Practical wrapper for arrayf_struct.
Definition: arrayf.h:47
polyf arrayf_polyf(arrayf l)
Returns the polynomial with the coefficients in the list l.
arrayf arrayf_new_polyf(polyf P)
Returns the list of coefficients of the polynomial P.
long arrayf_first_nan(arrayf l)
Checks if all complex numbers in the list l are well defined.
bool arrayf_append(arrayf l, char *fileName, bool verbose)
Writes the list l to the end of a CSV file with the given path fileName.
arrayf_struct * arrayf
Convenience pointer to arrayf_struct.
Definition: arrayf.h:50
arrayf arrayf_new(ulong size)
Returns a new empty list with memory size at least size.
long arrayf_first_inf(arrayf l)
Checks if there are infinite values in the list l.
bool arrayf_free(arrayf l)
Frees all the memory used by the list l, assuming the struct has been allocated with malloc(),...
arrayf arrayf_new_polyfr(polyfr P)
Returns the list of coefficients of the real polynomial P.
Definition of machine complex numbers.
compf_struct compf[1]
Practical wrapper for compf_struct.
Definition: compf.h:43
Definition of basic types.
uint64_t ulong
ulong is uint64
Definition: ntypes.h:37
Definition of complex polynomials with machine floating point coefficients.
Definition of real polynomials with machine floating point coefficients.
A variable length list of machine floating point complex numbers.
Definition: arrayf.h:38
compf_ptr zi
the elements of the list
Definition: arrayf.h:41
ulong size
the present capacity of the list (memory size in number of complex numbers)
Definition: arrayf.h:40
ulong len
the number of complex numbers in the list
Definition: arrayf.h:39
Machine complex numbers.
Definition: compf.h:29
Polynomial with machine floating point complex coefficients.
Definition: polyf.h:30
Polynomial with machine floating point real coefficients.
Definition: polyfr.h:31