MPSolve 3.2.1
Loading...
Searching...
No Matches
horner.h File Reference

Horner implementation for Monomial polynomials. More...

Go to the source code of this file.

Functions

MPS_BEGIN_DECLS void mps_parhorner (mps_context *st, int n, mpc_t x, mpc_t p[], mps_boolean b[], mpc_t s, int n_thread)
 
void mps_aparhorner (mps_context *st, int n, rdpe_t x, rdpe_t p[], mps_boolean b[], rdpe_t s, int n_thread)
 
void mps_fhorner (mps_context *s, mps_monomial_poly *p, cplx_t x, cplx_t value)
 Evaluate the polynomial p in the point x. More...
 
void mps_fhorner_with_error (mps_context *s, mps_monomial_poly *p, cplx_t x, cplx_t value, double *relative_error)
 Evaluate the polynomial p in the point x, and give also a bound to the relative error occured in the computation. More...
 
void mps_dhorner (mps_context *s, mps_monomial_poly *p, cdpe_t x, cdpe_t value)
 Evaluate the polynomial p in the point x. More...
 
void mps_dhorner_with_error (mps_context *s, mps_monomial_poly *p, cdpe_t x, cdpe_t value, rdpe_t relative_error)
 Evaluate the polynomial p in the point x, and give also a bound to the relative error occured in the computation. More...
 
void mps_mhorner (mps_context *s, mps_monomial_poly *p, mpc_t x, mpc_t value)
 Compute the value of the polynomial p in the point x and save it in value. If you need a bound to the relative error, try mps_mhorner_with_error(). More...
 
void mps_mhorner_with_error (mps_context *s, mps_monomial_poly *p, mpc_t x, mpc_t value, rdpe_t relative_error, long int wp)
 Compute the value of the polynomial p in the point x and save it in value. More...
 
void mps_mhorner_with_error2 (mps_context *s, mps_monomial_poly *p, mpc_t x, mpc_t value, rdpe_t relative_error, long int wp)
 Compute the value of the polynomial p in the point x and save it in value. More...
 

Detailed Description

Horner implementation for Monomial polynomials.

Function Documentation

◆ mps_dhorner()

void mps_dhorner ( mps_context s,
mps_monomial_poly p,
cdpe_t  x,
cdpe_t  value 
)

Evaluate the polynomial p in the point x.

Parameters
sThe mps_context of the computation.
pThe mps_monomial_poly to evaluate.
xThe point where the polynomial will be evaluated.
valueThe value computed by the function.

◆ mps_dhorner_with_error()

void mps_dhorner_with_error ( mps_context s,
mps_monomial_poly p,
cdpe_t  x,
cdpe_t  value,
rdpe_t  error 
)

Evaluate the polynomial p in the point x, and give also a bound to the relative error occured in the computation.

Parameters
sThe mps_context of the computation.
pThe mps_monomial_poly to evaluate.
xThe point where the polynomial will be evaluated.
valueThe value computed by the function.
errorA bound to the absolute error of the computation.

◆ mps_fhorner()

void mps_fhorner ( mps_context s,
mps_monomial_poly p,
cplx_t  x,
cplx_t  value 
)

Evaluate the polynomial p in the point x.

Parameters
sThe mps_context of the computation.
pThe mps_monomial_poly to evaluate.
xThe point where the polynomial will be evaluated.
valueThe value computed by the function.

◆ mps_fhorner_with_error()

void mps_fhorner_with_error ( mps_context s,
mps_monomial_poly p,
cplx_t  x,
cplx_t  value,
double *  error 
)

Evaluate the polynomial p in the point x, and give also a bound to the relative error occured in the computation.

Parameters
sThe mps_context of the computation.
pThe mps_monomial_poly to evaluate.
xThe point where the polynomial will be evaluated.
errorA pointer to the location when an upper bound to the computation error will be stored.
valueThe value computed by the function.

◆ mps_mhorner()

void mps_mhorner ( mps_context s,
mps_monomial_poly p,
mpc_t  x,
mpc_t  value 
)

Compute the value of the polynomial p in the point x and save it in value. If you need a bound to the relative error, try mps_mhorner_with_error().

Parameters
sThe mps_context of the computation.
pThe monomial_poly to evaluate.
xThe point where the polynomial will be evaluated.
valueThe multiprecision complex variable where the result will be stored.

◆ mps_mhorner_with_error()

void mps_mhorner_with_error ( mps_context s,
mps_monomial_poly p,
mpc_t  x,
mpc_t  value,
rdpe_t  relative_error,
long int  wp 
)

Compute the value of the polynomial p in the point x and save it in value.

A upper bound to the relative error of the evaluation will be stored in relative_error.

Parameters
sThe mps_context of the computation.
pThe monomial_poly to evaluate.
xThe point where the polynomial will be evaluated.
valueThe multiprecision complex variable where the result will be stored.
relative_errorThe RDPE where the relative error will be saved.
wpThe working precision to use for the computation. If this value is 0 then s->mpwp will be used.

◆ mps_mhorner_with_error2()

void mps_mhorner_with_error2 ( mps_context s,
mps_monomial_poly p,
mpc_t  x,
mpc_t  value,
rdpe_t  error,
long int  wp 
)

Compute the value of the polynomial p in the point x and save it in value.

A upper bound to the relative error of the evaluation will be stored in relative_error. The error is computed using the formula

\[
 n \frac{ap(|x|)}{|p(x)|} u
\]

where $ap(x)$ is the polynomial with the coefficients equal to the moduli of the coefficients of $p(x)$.

Parameters
sThe mps_context of the computation.
pThe monomial_poly to evaluate.
xThe point where the polynomial will be evaluated.
valueThe multiprecision complex variable where the result will be stored.
errorThe RDPE where the absolute error will be saved.
wpThe working precision to use for the computation. If this value is 0 then s->mpwp will be used.