FastPolyEval  1.0
Fast Evaluation of Real and Complex Polynomials
array.h
Go to the documentation of this file.
1 //
2 // array.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 array_h
21 #define array_h
22 
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <mpfr.h>
26 
27 #include "ntypes.h"
28 #include "comp.h"
29 #include "poly.h"
30 #include "polyr.h"
31 
32 #define ARRAY_MIN_SIZE 100
33 #define ARRAY_SIZE_INCREASE 1.25
34 
37 typedef struct {
41 } array_struct;
42 
46 typedef array_struct array_t[1];
47 
50 
51 // MARK: functions prototypes
52 
59 
67 
75 
82 bool array_free(array l);
83 
92 bool array_add(array l, comp z, prec_t prec);
93 
101 
108 
115 
122 
130 
138 
139 // MARK: IO operations
140 
149 bool array_write(array l, char *fileName, int digits, bool verbose);
150 
159 bool array_append(array l, char *fileName, int digits, bool verbose);
160 
168 array array_read(char *fileName, prec_t prec, bool verbose);
169 
170 #endif /* array_h */
array array_new_polyr(polyr P, prec_t prec)
Returns the array of coefficients of the real polynomial P.
array array_new_poly(poly P, prec_t prec)
Returns the array of coefficients of the polynomial P.
comp_ptr array_get(array l, ulong pos)
Returns the pointer of the element on position pos in the array l.
bool array_free(array l)
Frees all the memory used by the array l, assuming the struct has been allocated with malloc(),...
array_struct * array
Convenience pointer to array_struct.
Definition: array.h:49
poly array_poly(array l, prec_t prec)
Returns the polynomial with the coefficients in the array l.
bool array_write(array l, char *fileName, int digits, bool verbose)
Writes the array l to a CSV file with the given path fileName.
long array_first_nan(array l)
Checks if all complex numbers in the list l are well defined.
array_struct array_t[1]
Practical wrapper for array_struct.
Definition: array.h:46
bool array_add(array l, comp z, prec_t prec)
Adds the complex number z at the end of the array. The size of the array is automatically increased,...
polyr array_polyr(array l, prec_t prec)
Returns the real polynomial with the coefficients the real parts of the complex numbers in the array ...
array array_read(char *fileName, prec_t prec, bool verbose)
Reads a array of complex numbers of precision prec from the CSV file with path fileName.
bool array_append(array l, char *fileName, int digits, bool verbose)
Writes the array l to the end of a CSV file with the given path fileName.
bool array_is_real(array l)
Checks if all complex numbers in the array l are real.
long array_first_inf(array l)
Checks if there are infinite values in the list l.
array array_new(ulong size)
Returns a new empty array with memory size at least size.
Definition of MPFR complex numbers.
comp_struct comp[1]
Practical wrapper for comp_struct.
Definition: comp.h:39
Definition of basic types.
ulong prec_t
The integer number type to use for polynomial degrees and indexes.
Definition: ntypes.h:188
uint64_t ulong
ulong is uint64
Definition: ntypes.h:37
Definition of complex polynomials with arbitary precision coefficients.
Definition of real polynomials with arbitary precision coefficients.
A variable length array of machine floating point complex numbers.
Definition: array.h:37
ulong size
the present capacity of the array (memory size in number of complex numbers)
Definition: array.h:39
comp_ptr zi
the elements of the array
Definition: array.h:40
ulong len
the number of complex numbers in the array
Definition: array.h:38
Multi-precision floating point complex numbers.
Definition: comp.h:31
Polynomial with multi-precision floating point complex coefficients.
Definition: poly.h:31
Polynomial with multi-precision floating point complex coefficients.
Definition: polyr.h:31