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

Definition of real polynomials with machine floating point coefficients. More...

Go to the source code of this file.

Data Structures

struct  polyfr_struct
 Polynomial with machine floating point real coefficients. More...
 

Typedefs

typedef polyfr_struct polyfr_t[1]
 Practical wrapper for polyfr_struct. More...
 
typedef polyfr_structpolyfr
 Convenience pointer to polyfr_struct.
 

Functions

polyfr polyfr_new (deg_t degree)
 Returns a new real polynomial of given degree, with machine floating point coefficients. More...
 
bool polyfr_free (polyfr P)
 Frees all the memory used by the polynomial P, assuming the struct has been allocated with malloc(), for example with polyfr_new(). More...
 
bool polyfr_set (polyfr P, coeff_t coeff, deg_t ind)
 Sets the coefficient corresponding to the power ind to coeff. More...
 
coeff_t polyfr_get (polyfr P, deg_t ind)
 Returns the coefficient corresponding to the power ind. More...
 
bool polyfr_eval_c (compf res, polyfr P, compf z)
 Evaluates P(z) using Horner's method. More...
 
coeff_t polyfr_eval (polyfr P, coeff_t x)
 Evaluates P(x) using Horner's method. More...
 
polyf polyfr_comp (polyfr P)
 Return a complex version of the real polynomial P. More...
 
polyfr polyfr_derivative (polyfr P)
 Computes the derivative of P. More...
 
polyfr polyfr_sum (polyfr P, polyfr Q)
 Computes P+Q. More...
 
polyfr polyfr_diff (polyfr P, polyfr Q)
 Computes P-Q. More...
 
polyfr polyfr_prod (polyfr P, polyfr Q)
 Computes P*Q. More...
 
polyfr polyfr_sqr (polyfr P)
 Computes the square of P. More...
 
polyfr polyf_hyp (int n)
 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...
 
polyfr polyf_cheb (int n)
 Computes the Chebyshev polynomial of degree n. More...
 
polyfr polyf_leg (int n)
 Computes the Legendre polynomial of degree n. More...
 
polyfr polyf_her (int n)
 Computes the Hermite polynomial of degree n. More...
 
polyfr polyf_lag (int n)
 Computes the Laguerre polynomial of degree n. More...
 

Detailed Description

Definition of real polynomials with machine floating point coefficients.

Definition in file polyfr.h.

Typedef Documentation

◆ polyfr_t

typedef polyfr_struct polyfr_t[1]

Practical wrapper for polyfr_struct.

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

Definition at line 40 of file polyfr.h.

Function Documentation

◆ polyf_cheb()

polyfr polyf_cheb ( int  n)

Computes the Chebyshev polynomial of degree n.

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

◆ polyf_her()

polyfr polyf_her ( int  n)

Computes the Hermite polynomial of degree n.

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

◆ polyf_hyp()

polyfr polyf_hyp ( int  n)

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
Returns
the hyperbolic polynomial, NULL if some error occurred.

◆ polyf_lag()

polyfr polyf_lag ( int  n)

Computes the Laguerre polynomial of degree n.

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

◆ polyf_leg()

polyfr polyf_leg ( int  n)

Computes the Legendre polynomial of degree n.

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

◆ polyfr_comp()

polyf polyfr_comp ( polyfr  P)

Return a complex version of the real polynomial P.

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

◆ polyfr_derivative()

polyfr polyfr_derivative ( polyfr  P)

Computes the derivative of P.

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

◆ polyfr_diff()

polyfr polyfr_diff ( polyfr  P,
polyfr  Q 
)

Computes P-Q.

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

◆ polyfr_eval()

coeff_t polyfr_eval ( polyfr  P,
coeff_t  x 
)

Evaluates P(x) using Horner's method.

Parameters
Pthe polynomial
xthe argument
Returns
the result, NaN if some error occurred.

◆ polyfr_eval_c()

bool polyfr_eval_c ( compf  res,
polyfr  P,
compf  z 
)

Evaluates P(z) using Horner's method.

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

◆ polyfr_free()

bool polyfr_free ( polyfr  P)

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

Parameters
Pthe polynomial
Returns
true if successfull, false otherwise.

◆ polyfr_get()

coeff_t polyfr_get ( polyfr  P,
deg_t  ind 
)

Returns the coefficient corresponding to the power ind.

Parameters
Pthe polynomial
indthe index
Returns
the coefficient corresponding to the power ind.

◆ polyfr_new()

polyfr polyfr_new ( deg_t  degree)

Returns a new real polynomial of given degree, with machine floating point coefficients.

Parameters
degreethe degree of the polynomial
Returns
the new polynomial, NULL if the degree is larger than MAX_DEG.

◆ polyfr_prod()

polyfr polyfr_prod ( polyfr  P,
polyfr  Q 
)

Computes P*Q.

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

◆ polyfr_set()

bool polyfr_set ( polyfr  P,
coeff_t  coeff,
deg_t  ind 
)

Sets the coefficient corresponding to the power ind to coeff.

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

◆ polyfr_sqr()

polyfr polyfr_sqr ( polyfr  P)

Computes the square of P.

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

◆ polyfr_sum()

polyfr polyfr_sum ( polyfr  P,
polyfr  Q 
)

Computes P+Q.

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