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

Definition of a buffer for pre-computed powers of a complex number with arbitary precision. More...

Go to the source code of this file.

Data Structures

struct  pows_struct
 The powers of the complex number z using multi-precision floating point numbers. More...
 

Typedefs

typedef pows_struct pows_t[1]
 Practical wrapper for pows_struct. More...
 
typedef pows_structpows
 Convenience pointer to eval_struct.
 

Functions

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 size powers. More...
 
bool pows_free (pows zn)
 Frees all the memory used by the buffer zn, assuming the struct has been allocated with malloc(), for example with pows_new(). More...
 
bool pows_set (pows zn, comp z)
 Sets the complex number of which the powers will be computed by the buffer zn. More...
 
comp_ptr pows_pow (pows zn, deg_t pow)
 Computes z^pow using repeated squares method and the cache of previously computed powers. More...
 
comp_ptr pows_pow_once (pows zn, deg_t pow)
 Computes z^pow using repeated squares method and the cache of previously computed powers. More...
 

Detailed Description

Definition of a buffer for pre-computed powers of a complex number with arbitary precision.

Definition in file pows.h.

Typedef Documentation

◆ pows_t

typedef pows_struct pows_t[1]

Practical wrapper for pows_struct.

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

Definition at line 45 of file pows.h.

Function Documentation

◆ pows_free()

bool pows_free ( pows  zn)

Frees all the memory used by the buffer zn, assuming the struct has been allocated with malloc(), for example with pows_new().

Parameters
znthe powers buffer
Returns
true if successfull, false otherwise.

◆ pows_new()

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 size powers.

Warning
prec must be at least precf and size at most MAX_DEG.
Parameters
precthe precision of the coefficients, in bits
sizethe size of the buffer
Returns
the new buffer, NULL if some error occurred.

◆ pows_pow()

comp_ptr pows_pow ( pows  zn,
deg_t  pow 
)

Computes z^pow using repeated squares method and the cache of previously computed powers.

It caches intermediary powers of z that have been computed to accelerate later calls of this function. Also, if pow is larger than the size of the buffer zn, it is automatically increased to store the result.

Parameters
znthe powers buffer
powthe power to compute
Returns
the result z^pow, NULL if some error occurred.

◆ pows_pow_once()

comp_ptr pows_pow_once ( pows  zn,
deg_t  pow 
)

Computes z^pow using repeated squares method and the cache of previously computed powers.

It does NOT cache intermediary powers of z into zn.

Parameters
znthe powers buffer
powthe power to compute
Returns
the result z^pow, NULL if some error occurred.

◆ pows_set()

bool pows_set ( pows  zn,
comp  z 
)

Sets the complex number of which the powers will be computed by the buffer zn.

Parameters
znthe powers buffer
zthe complex number
Returns
true if successfull, false otherwise.