FastPolyEval  1.0
Fast Evaluation of Real and Complex Polynomials
Data Structures | Macros | Typedefs | Functions
array.h File Reference

Definition of a variable length array of arbitary precision complex numbers that are based on mpfr. More...

Go to the source code of this file.

Data Structures

struct  array_struct
 A variable length array of machine floating point complex numbers. More...
 

Macros

#define ARRAY_MIN_SIZE   100
 
#define ARRAY_SIZE_INCREASE   1.25
 

Typedefs

typedef array_struct array_t[1]
 Practical wrapper for array_struct. More...
 
typedef array_structarray
 Convenience pointer to array_struct.
 

Functions

array array_new (ulong size)
 Returns a new empty array with memory size at least size. More...
 
array array_new_polyr (polyr P, prec_t prec)
 Returns the array of coefficients of the real polynomial P. More...
 
array array_new_poly (poly P, prec_t prec)
 Returns the array of coefficients of the polynomial P. More...
 
bool array_free (array l)
 Frees all the memory used by the array l, assuming the struct has been allocated with malloc(), for example with array_new(). More...
 
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, if needed. More...
 
comp_ptr array_get (array l, ulong pos)
 Returns the pointer of the element on position pos in the array l. More...
 
bool array_is_real (array l)
 Checks if all complex numbers in the array l are real. More...
 
long array_first_inf (array l)
 Checks if there are infinite values in the list l. More...
 
long array_first_nan (array l)
 Checks if all complex numbers in the list l are well defined. More...
 
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 l. More...
 
poly array_poly (array l, prec_t prec)
 Returns the polynomial with the coefficients in the array l. More...
 
bool array_write (array l, char *fileName, int digits, bool verbose)
 Writes the array l to a CSV file with the given path fileName. More...
 
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. More...
 
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. More...
 

Detailed Description

Definition of a variable length array of arbitary precision complex numbers that are based on mpfr.

Definition in file array.h.

Typedef Documentation

◆ array_t

typedef array_struct array_t[1]

Practical wrapper for array_struct.

To avoid the constant use * and & the type array_t is a pointer.

Definition at line 46 of file array.h.

Function Documentation

◆ array_add()

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, if needed.

Parameters
lthe array
zthe new element to add to the array
precthe precision of the number in the array
Returns
true if successfull, false otherwise.

◆ array_append()

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.

Parameters
lthe array
fileNamethe path of the CSV file
digitsthe number of digits after the decimal point of the numbers in the file
verbosetrue to print information about the error, if any
Returns
true if successfull, false otherwise.

◆ array_first_inf()

long array_first_inf ( array  l)

Checks if there are infinite values in the list l.

Parameters
lthe list
Returns
the position of the first infinite value in l, -1 if there is none, LONG_MAX if some error occurred.

◆ array_first_nan()

long array_first_nan ( array  l)

Checks if all complex numbers in the list l are well defined.

Parameters
lthe list
Returns
the position of the first undefined value in l, -1 if there is none, LONG_MAX if some error occurred.

◆ array_free()

bool array_free ( array  l)

Frees all the memory used by the array l, assuming the struct has been allocated with malloc(), for example with array_new().

Parameters
lthe array
Returns
true if successfull, false otherwise.

◆ array_get()

comp_ptr array_get ( array  l,
ulong  pos 
)

Returns the pointer of the element on position pos in the array l.

Parameters
lthe array
posthe position of the element
Returns
the pointer to the element on position pos in l, NULL if some error occurred.

◆ array_is_real()

bool array_is_real ( array  l)

Checks if all complex numbers in the array l are real.

Parameters
lthe array
Returns
true if all elements in the array are real, false otherwise.

◆ array_new()

array array_new ( ulong  size)

Returns a new empty array with memory size at least size.

Parameters
sizethe number of elements to allocate memory for
Returns
the array, NULL if not enougn memory is available

◆ array_new_poly()

array array_new_poly ( poly  P,
prec_t  prec 
)

Returns the array of coefficients of the polynomial P.

Parameters
Pthe polynomial
precthe precision of the numbers in the array
Returns
the array, NULL if some error occurred.

◆ array_new_polyr()

array array_new_polyr ( polyr  P,
prec_t  prec 
)

Returns the array of coefficients of the real polynomial P.

Parameters
Pthe real polynomial
precthe precision of the numbers in the array
Returns
the array, NULL if some error occurred.

◆ array_poly()

poly array_poly ( array  l,
prec_t  prec 
)

Returns the polynomial with the coefficients in the array l.

Parameters
lthe array
precthe precision of the coefiicients of the polynomial
Returns
the polynomial, NULL if some error occurred.

◆ array_polyr()

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 l.

Parameters
lthe array
precthe precision of the coefiicients of the polynomial
Returns
the polynomial, NULL if some coefficients are not real or some other error occurred.

◆ array_read()

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.

Parameters
fileNamethe path of the CSV file
precthe precision
verbosetrue to print information about the file and the error, if any
Returns
the array of complex numbers in the CSV file, NULL if some error occurred.

◆ array_write()

bool array_write ( array  l,
char *  fileName,
int  digits,
bool  verbose 
)

Writes the array l to a CSV file with the given path fileName.

Parameters
lthe array
fileNamethe path of the CSV file
digitsthe number of digits after the decimal point of the numbers in the file
verbosetrue to print information about the error, if any
Returns
true if successfull, false otherwise.