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

Definition of polynomial evaluator with arbitary precision coefficients. More...

Go to the source code of this file.

Data Structures

struct  eval_struct
 Evaluator of polynomials with multi-precision floating point coefficients. More...
 

Macros

#define MIN_EVAL_PREC   8
 Minimum prcision for evaluators.
 
#define MIN_EVAL_PREC_STR   "8"
 
#define eval_lastValError(ev)   (ev->valErr)
 The [approximative] upper bound for the error of the last evaluation, in bits. Not reported by the Newton term computation.
 
#define eval_lastDerError(ev)   (ev->derErr)
 The [approximative] upper bound for the error of the last derivative evaluation, in bits. Not reported by the Newton term computation.
 

Typedefs

typedef eval_struct eval_t[1]
 Practical wrapper for eval_struct. More...
 
typedef eval_structeval
 Convenience pointer to eval_struct.
 

Functions

eval eval_new (poly P, prec_t prec)
 Returns a new evaluator of the complex polynomial P. More...
 
eval eval_new_r (polyr Q, prec_t prec)
 Returns a new evaluator of the real polynomial Q. More...
 
bool eval_free (eval ev)
 Frees all the memory used by the evaluator ev, assuming the struct has been allocated with malloc(), for example with eval_new() or with eval_new_r(). More...
 
bool eval_val (comp v, eval ev, comp z)
 Evaluates ev->P(z) (or ev->Q(z)) using the method described in [1]. More...
 
bool eval_der (comp d, eval ev, comp z)
 Evaluates ev->P'(z) (or ev->Q'(z)) using the method described in [1]. More...
 
bool eval_val_der (comp v, comp d, eval ev, comp z)
 Evaluates ev->P(z) and ev->P'(z) (or ev->Q(z) and ev->Q'(z)) using the method described in [1]. More...
 
bool eval_newton (comp nt, eval ev, comp z)
 Computes the Newthon method step of ev->P (or ev->Q) using the method described in [1]. More...
 
bool eval_analyse (eval ev)
 Analyses the complex polynomial ev->P, after some of its coefficients have been changed. More...
 
bool eval_analyse_r (eval ev)
 Analyses the real polynomial ev->Q, after some of its coefficients have been changed. More...
 
bool eval_val_cc (comp v, eval ev, comp z)
 Evaluates ev->P(x) using the method described in [1]. More...
 
bool eval_der_cc (comp d, eval ev, comp z)
 Evaluates ev->P'(x) using the method described in [1]. More...
 
bool eval_val_der_cc (comp v, comp d, eval ev, comp z)
 Evaluates ev->P(x) and ev->P'(x) using the method described in [1]. More...
 
bool eval_newton_cc (comp nt, eval ev, comp z)
 Computes the Newthon method step of ev->P using the method described in [1]. More...
 
bool eval_val_cr (comp v, eval ev, mpfr_t x)
 Evaluates ev->P(x) using the method described in [1]. More...
 
bool eval_der_cr (comp d, eval ev, mpfr_t x)
 Evaluates ev->P'(x) using the method described in [1]. More...
 
bool eval_val_der_cr (comp v, comp d, eval ev, mpfr_t x)
 Evaluates ev->P(x) and ev->P'(x) using the method described in [1]. More...
 
bool eval_newton_cr (comp nt, eval ev, mpfr_t x)
 Computes the Newthon method step of ev->P using the method described in [1]. More...
 
bool eval_val_rc (comp v, eval ev, comp z)
 Evaluates ev->Q(x) using the method described in [1]. More...
 
bool eval_der_rc (comp d, eval ev, comp z)
 Evaluates ev->Q'(x) using the method described in [1]. More...
 
bool eval_val_der_rc (comp v, comp d, eval ev, comp z)
 Evaluates ev->Q(x) and ev->Q'(x) using the method described in [1]. More...
 
bool eval_newton_rc (comp nt, eval ev, comp z)
 Computes the Newthon method step of ev->Q using the method described in [1]. More...
 
bool eval_val_rr (mpfr_t v, eval ev, mpfr_t x)
 Evaluates the real polynomial ev->Q(x) using the method described in [1]. More...
 
bool eval_der_rr (mpfr_t d, eval ev, mpfr_t x)
 Evaluates the derivative of real polynomial ev->Q'(x) using the method described in [1]. More...
 
bool eval_val_der_rr (mpfr_t v, mpfr_t d, eval ev, mpfr_t x)
 Evaluates ev->Q(x) and ev->Q'(x) using the method described in [1]. More...
 
bool eval_newton_rr (mpfr_t nt, eval ev, mpfr_t x)
 Computes the Newthon method step of the real polynomial ev->Q using the method described in [1]. More...
 

Detailed Description

Definition of polynomial evaluator with arbitary precision coefficients.

Definition in file eval.h.

Typedef Documentation

◆ eval_t

typedef eval_struct eval_t[1]

Practical wrapper for eval_struct.

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

Definition at line 60 of file eval.h.

Function Documentation

◆ eval_analyse()

bool eval_analyse ( eval  ev)

Analyses the complex polynomial ev->P, after some of its coefficients have been changed.

Note
The general functions eval_val(), eval_der(), eval_val_der() and eval_newton() automatically analyse the appropriate polynomial. Use this function only with the optimized versions like eval_val_cx().
Parameters
evthe evaluator
Returns
true if ev is ready to use, false otherwise.

◆ eval_analyse_r()

bool eval_analyse_r ( eval  ev)

Analyses the real polynomial ev->Q, after some of its coefficients have been changed.

Note
The general functions eval_val(), eval_der(), eval_val_der() and eval_newton() automatically analyse the appropriate polynomial. Use this function only with the optimized versions like eval_val_rx().
Parameters
evthe evaluator
Returns
true if ev is ready to use, false otherwise.

◆ eval_der()

bool eval_der ( comp  d,
eval  ev,
comp  z 
)

Evaluates ev->P'(z) (or ev->Q'(z)) using the method described in [1].

Note
This function chooses the quickest variant to compute, depending if the polynomial of ev and / or z are real.
Parameters
dthe result
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_der_cc()

bool eval_der_cc ( comp  d,
eval  ev,
comp  z 
)

Evaluates ev->P'(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
dthe result
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_der_cr()

bool eval_der_cr ( comp  d,
eval  ev,
mpfr_t  x 
)

Evaluates ev->P'(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
dthe result
evthe evaluator
xthe real argument
Returns
true if successfull, false otherwise.

◆ eval_der_rc()

bool eval_der_rc ( comp  d,
eval  ev,
comp  z 
)

Evaluates ev->Q'(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
dthe result
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_der_rr()

bool eval_der_rr ( mpfr_t  d,
eval  ev,
mpfr_t  x 
)

Evaluates the derivative of real polynomial ev->Q'(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
dthe derivative
evthe evaluator
xthe real argument
Returns
true if successfull, false otherwise.

◆ eval_free()

bool eval_free ( eval  ev)

Frees all the memory used by the evaluator ev, assuming the struct has been allocated with malloc(), for example with eval_new() or with eval_new_r().

Parameters
evthe evaluator
Returns
true if successfull, false otherwise.

◆ eval_new()

eval eval_new ( poly  P,
prec_t  prec 
)

Returns a new evaluator of the complex polynomial P.

Parameters
Pthe complex polynomial
precthe precision of evaluations, in bits
Returns
the new evaluator, NULL if some error occurred.

◆ eval_new_r()

eval eval_new_r ( polyr  Q,
prec_t  prec 
)

Returns a new evaluator of the real polynomial Q.

Parameters
Qthe real polynomial
precthe precision of evaluations, in bits
Returns
the new evaluator, NULL if some error occurred.

◆ eval_newton()

bool eval_newton ( comp  nt,
eval  ev,
comp  z 
)

Computes the Newthon method step of ev->P (or ev->Q) using the method described in [1].

Note
This function chooses the quickest variant to compute, depending if the polynomial of ev and / or z are real.
Parameters
ntthe Newton term
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_newton_cc()

bool eval_newton_cc ( comp  nt,
eval  ev,
comp  z 
)

Computes the Newthon method step of ev->P using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
ntthe Newton term
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_newton_cr()

bool eval_newton_cr ( comp  nt,
eval  ev,
mpfr_t  x 
)

Computes the Newthon method step of ev->P using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
ntthe Newton term
evthe evaluator
xthe real argument
Returns
true if successfull, false otherwise.

◆ eval_newton_rc()

bool eval_newton_rc ( comp  nt,
eval  ev,
comp  z 
)

Computes the Newthon method step of ev->Q using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
ntthe Newton term
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_newton_rr()

bool eval_newton_rr ( mpfr_t  nt,
eval  ev,
mpfr_t  x 
)

Computes the Newthon method step of the real polynomial ev->Q using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
ntthe Newton term
evthe evaluator
xthe real argument
Returns
true if successfull, false otherwise.

◆ eval_val()

bool eval_val ( comp  v,
eval  ev,
comp  z 
)

Evaluates ev->P(z) (or ev->Q(z)) using the method described in [1].

Note
This function chooses the quickest variant to compute, depending if the polynomial of ev and / or z are real.
Parameters
vthe result
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_val_cc()

bool eval_val_cc ( comp  v,
eval  ev,
comp  z 
)

Evaluates ev->P(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
vthe result
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_val_cr()

bool eval_val_cr ( comp  v,
eval  ev,
mpfr_t  x 
)

Evaluates ev->P(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
vthe result
evthe evaluator
xthe real argument
Returns
true if successfull, false otherwise.

◆ eval_val_der()

bool eval_val_der ( comp  v,
comp  d,
eval  ev,
comp  z 
)

Evaluates ev->P(z) and ev->P'(z) (or ev->Q(z) and ev->Q'(z)) using the method described in [1].

Note
This function chooses the quickest variant to compute, depending if the polynomial of ev and / or z are real.
Parameters
vthe value
dthe derivative
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_val_der_cc()

bool eval_val_der_cc ( comp  v,
comp  d,
eval  ev,
comp  z 
)

Evaluates ev->P(x) and ev->P'(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
vthe value
dthe derivative
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_val_der_cr()

bool eval_val_der_cr ( comp  v,
comp  d,
eval  ev,
mpfr_t  x 
)

Evaluates ev->P(x) and ev->P'(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
vthe value
dthe derivative
evthe evaluator
xthe real argument
Returns
true if successfull, false otherwise.

◆ eval_val_der_rc()

bool eval_val_der_rc ( comp  v,
comp  d,
eval  ev,
comp  z 
)

Evaluates ev->Q(x) and ev->Q'(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
vthe value
dthe derivative
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_val_der_rr()

bool eval_val_der_rr ( mpfr_t  v,
mpfr_t  d,
eval  ev,
mpfr_t  x 
)

Evaluates ev->Q(x) and ev->Q'(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
vthe value
dthe derivative
evthe evaluator
xthe real argument
Returns
true if successfull, false otherwise.

◆ eval_val_rc()

bool eval_val_rc ( comp  v,
eval  ev,
comp  z 
)

Evaluates ev->Q(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
vthe result
evthe evaluator
zthe complex argument
Returns
true if successfull, false otherwise.

◆ eval_val_rr()

bool eval_val_rr ( mpfr_t  v,
eval  ev,
mpfr_t  x 
)

Evaluates the real polynomial ev->Q(x) using the method described in [1].

Warning
For maximum speed, no checks are performed on the parameters, on the type of polynomial represented by ev nor if the polynomial has been pre-conditionned after the last coefficient update.
Parameters
vthe value
evthe evaluator
xthe real argument
Returns
true if successfull, false otherwise.