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

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

Go to the source code of this file.

Data Structures

struct  polyf_struct
 Polynomial with machine floating point complex coefficients. More...
 

Typedefs

typedef polyf_struct polyf_t[1]
 Practical wrapper for polyf_struct. More...
 
typedef polyf_structpolyf
 Convenience pointer to polyf_struct.
 

Functions

polyf polyf_new (deg_t degree)
 Returns a new complex polynomial of given degree, with machine floating point coefficients. More...
 
polyf polyf_from_roots (compf_ptr roots, deg_t degree)
 Returns a new complex polynomial given the list of its roots, with machine floating point coefficients. More...
 
bool polyf_free (polyf 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 polyf_set (polyf P, compf coeff, deg_t ind)
 Sets the coefficient of the polynomial P corresponding to the power ind to coeff. More...
 
bool polyf_eval (compf res, polyf P, compf z)
 Evaluates P(z) using Horner's method. More...
 
bool polyf_eval_r (compf res, polyf P, coeff_t x)
 Evaluates P(x) using Horner's method. More...
 
polyf polyf_derivative (polyf P)
 Computes the derivative of P. More...
 
polyf polyf_sum (polyf P, polyf Q)
 Computes P+Q. More...
 
polyf polyf_diff (polyf P, polyf Q)
 Computes P-Q. More...
 
polyf polyf_prod (polyf P, polyf Q)
 Computes P*Q. More...
 
polyf polyf_sqr (polyf P)
 Computes the square of P. More...
 

Detailed Description

Definition of complex polynomials with machine floating point coefficients.

Definition in file polyf.h.

Typedef Documentation

◆ polyf_t

typedef polyf_struct polyf_t[1]

Practical wrapper for polyf_struct.

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

Definition at line 39 of file polyf.h.

Function Documentation

◆ polyf_derivative()

polyf polyf_derivative ( polyf  P)

Computes the derivative of P.

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

◆ polyf_diff()

polyf polyf_diff ( polyf  P,
polyf  Q 
)

Computes P-Q.

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

◆ polyf_eval()

bool polyf_eval ( compf  res,
polyf  P,
compf  z 
)

Evaluates P(z) using Horner's method.

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

◆ polyf_eval_r()

bool polyf_eval_r ( compf  res,
polyf  P,
coeff_t  x 
)

Evaluates P(x) using Horner's method.

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

◆ polyf_free()

bool polyf_free ( polyf  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.

◆ polyf_from_roots()

polyf polyf_from_roots ( compf_ptr  roots,
deg_t  degree 
)

Returns a new complex polynomial given the list of its roots, with machine floating point coefficients.

Parameters
rootsthe roots of the polynomial
degreethe degree of the polynomial
Returns
the new polynomial, NULL if some error occurred.

◆ polyf_new()

polyf polyf_new ( deg_t  degree)

Returns a new complex 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.

◆ polyf_prod()

polyf polyf_prod ( polyf  P,
polyf  Q 
)

Computes P*Q.

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

◆ polyf_set()

bool polyf_set ( polyf  P,
compf  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.

◆ polyf_sqr()

polyf polyf_sqr ( polyf  P)

Computes the square of P.

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

◆ polyf_sum()

polyf polyf_sum ( polyf  P,
polyf  Q 
)

Computes P+Q.

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