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

Definition of real polynomials with arbitary precision coefficients. More...

Go to the source code of this file.

Data Structures

struct  polyr_struct
 Polynomial with multi-precision floating point complex coefficients. More...
 

Typedefs

typedef polyr_struct polyr_t[1]
 Practical wrapper for polyr_struct. More...
 
typedef polyr_structpolyr
 Convenience pointer to polyr_struct.
 

Functions

polyr polyr_new (deg_t degree, prec_t prec)
 Returns a new real polynomial of given degree, with coefficients of precision prec. More...
 
bool polyr_free (polyr P)
 Frees all the memory used by the polynomial P, assuming the struct has been allocated with malloc(), for example with polyr_new(). More...
 
bool polyr_set (polyr P, mpfr_t coeff, deg_t ind)
 Sets the coefficient of the polynomial P corresponding to the power ind to coeff. More...
 
bool polyr_seti (polyr P, long coeff, deg_t ind)
 Sets the coefficient of the polynomial P corresponding to the power ind to coeff. More...
 
bool polyr_eval_c (comp res, polyr P, comp z)
 Evaluates P(z) using Horner's method. More...
 
bool polyr_eval (mpfr_t res, polyr P, mpfr_t x)
 Evaluates P(x) using Horner's method. More...
 
polyr polyr_derivative (polyr P)
 Computes the derivative of P. More...
 
polyr polyr_sum (polyr P, polyr Q)
 Computes P+Q. More...
 
polyr polyr_diff (polyr P, polyr Q)
 Computes P-Q. More...
 
polyr polyr_prod (polyr P, polyr Q)
 Computes P*Q. More...
 
polyr polyr_sqr (polyr P)
 Computes the square of P. More...
 
polyr poly_hyp (int n, prec_t prec)
 Computes the n-th hyperbolic polynomial, the n-th image of 0 under the iteration of z->z^2+c. It is a polynomial of degree 2^{n-1} in c. More...
 
polyr poly_cheb (int n, prec_t prec)
 Computes the Chebyshev polynomial of degree n. More...
 
polyr poly_leg (int n, prec_t prec)
 Computes the Legendre polynomial of degree n. More...
 
polyr poly_her (int n, prec_t prec)
 Computes the Hermite polynomial of degree n. More...
 
polyr poly_lag (int n, prec_t prec)
 Computes the Laguerre polynomial of degree n. More...
 

Detailed Description

Definition of real polynomials with arbitary precision coefficients.

Definition in file polyr.h.

Typedef Documentation

◆ polyr_t

typedef polyr_struct polyr_t[1]

Practical wrapper for polyr_struct.

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

Definition at line 43 of file polyr.h.

Function Documentation

◆ poly_cheb()

polyr poly_cheb ( int  n,
prec_t  prec 
)

Computes the Chebyshev polynomial of degree n.

Parameters
nthe degree of the polynomial
precthe precision of the coefficients
Returns
the Chebyshev polynomial, NULL if some error occurred.

◆ poly_her()

polyr poly_her ( int  n,
prec_t  prec 
)

Computes the Hermite polynomial of degree n.

Parameters
nthe degree of the polynomial
precthe precision of the coefficients
Returns
the Hermite polynomial, NULL if some error occurred.

◆ poly_hyp()

polyr poly_hyp ( int  n,
prec_t  prec 
)

Computes the n-th hyperbolic polynomial, the n-th image of 0 under the iteration of z->z^2+c. It is a polynomial of degree 2^{n-1} in c.

Parameters
nthe order of the polynomial
precthe precision of the coefficients
Returns
the hyperbolic polynomial, NULL if some error occurred.

◆ poly_lag()

polyr poly_lag ( int  n,
prec_t  prec 
)

Computes the Laguerre polynomial of degree n.

Parameters
nthe degree of the polynomial
precthe precision of the coefficients
Returns
the Laguerre polynomial, NULL if some error occurred.

◆ poly_leg()

polyr poly_leg ( int  n,
prec_t  prec 
)

Computes the Legendre polynomial of degree n.

Parameters
nthe degree of the polynomial
precthe precision of the coefficients
Returns
the Legendre polynomial, NULL if some error occurred.

◆ polyr_derivative()

polyr polyr_derivative ( polyr  P)

Computes the derivative of P.

Parameters
Pthe polynomial
Returns
the resulted polynomial, NULL if some error occurred.

◆ polyr_diff()

polyr polyr_diff ( polyr  P,
polyr  Q 
)

Computes P-Q.

Parameters
Pa polynomial
Qanother polynomial
Returns
the resulted polynomial, NULL if some error occurred.

◆ polyr_eval()

bool polyr_eval ( mpfr_t  res,
polyr  P,
mpfr_t  x 
)

Evaluates P(x) using Horner's method.

Parameters
resthe result
Pthe polynomial
xthe real argument
Returns
true if successfull, false otherwise.

◆ polyr_eval_c()

bool polyr_eval_c ( comp  res,
polyr  P,
comp  z 
)

Evaluates P(z) using Horner's method.

Parameters
resthe result
Pthe polynomial
zthe argument
Returns
true if successfull, false otherwise.

◆ polyr_free()

bool polyr_free ( polyr  P)

Frees all the memory used by the polynomial P, assuming the struct has been allocated with malloc(), for example with polyr_new().

Parameters
Pthe polynomial
Returns
true if successfull, false otherwise.

◆ polyr_new()

polyr polyr_new ( deg_t  degree,
prec_t  prec 
)

Returns a new real polynomial of given degree, with coefficients of precision prec.

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

◆ polyr_prod()

polyr polyr_prod ( polyr  P,
polyr  Q 
)

Computes P*Q.

Parameters
Pa polynomial
Qanother polynomial
Returns
the resulted polynomial, NULL if some error occurred.

◆ polyr_set()

bool polyr_set ( polyr  P,
mpfr_t  coeff,
deg_t  ind 
)

Sets the coefficient of the polynomial P corresponding to the power ind to coeff.

Parameters
Pthe polynomial
coeffthe coefficient
indthe index
Returns
true if successfull, false otherwise.

◆ polyr_seti()

bool polyr_seti ( polyr  P,
long  coeff,
deg_t  ind 
)

Sets the coefficient of the polynomial P corresponding to the power ind to coeff.

Parameters
Pthe polynomial
coeffthe coefficient
indthe index
Returns
true if successfull, false otherwise.

◆ polyr_sqr()

polyr polyr_sqr ( polyr  P)

Computes the square of P.

Parameters
Pthe polynomial
Returns
the resulted polynomial, NULL if some error occurred.

◆ polyr_sum()

polyr polyr_sum ( polyr  P,
polyr  Q 
)

Computes P+Q.

Parameters
Pa polynomial
Qanother polynomial
Returns
the resulted polynomial, NULL if some error occurred.