Go to the source code of this file.
Classes | |
struct | MbsPolynomial |
Functions | |
MbsPolynomial * | mbs_polynomial_new (int order) |
Allocate a polynomial. More... | |
void * | mbs_polynomial_delete (MbsPolynomial *poly) |
Free a polynomial and return NULL. More... | |
MbsPolynomial * | mbs_polynomial_constrained (int nb_pos, double **pos_xy, int nb_deriv, double **deriv_xyp) |
Create a polynomial fulfilling the position and first derivative. More... | |
int | mbs_polynomial_eval (MbsPolynomial *poly, double x, double *y, int deriv) |
Evaluate the polynomial (or its nth derivative) at the provided coordinate. More... | |
int | mbs_polynomial_eval_vec (MbsPolynomial *poly, int nx, double *vx, double **p_vy, int deriv) |
Evaluate the polynomial (or its nth derivative) at the provided coordinates vector. More... | |
int | mbs_polynomial_print (MbsPolynomial *poly) |
Print information about the polynomial. More... | |
Declare polynomial related structures and functions for MBsysC.
Creation date: 21-06-2023
(c) Universite catholique de Louvain
MbsPolynomial* mbs_polynomial_constrained | ( | int | nb_pos, |
double ** | pos_xy, | ||
int | nb_deriv, | ||
double ** | deriv_xyp | ||
) |
Create a polynomial fulfilling the position and first derivative.
The function is not optimized and may use a big amount of memory for heavily constrained polynomial. It uses a LU decomposition to solve the system.
Polynomial interpolation is not adapted when order is high due to the Runge's phenomenon.
The order of the polynomial is computed from the number of condition set.
[in] | nb_pos | The number of position that the polynomial must pass by. Must be strictly positive. |
[in] | pos_xy | The array containing the x and y coordinates of the function. The size is [nb_pos; 2]. Duplicated x-coordinates are forbidden. |
[in] | nb_deriv | The number of specified polynomial derivative. Must be positive or null. |
[in] | deriv_xyp | The array containing the x coordinates and the yp derivative of the function. The size is [nb_pos; 2]. Duplicated x-coordinates are forbidden. NULL can be provided if nb_deriv is null. |
void* mbs_polynomial_delete | ( | MbsPolynomial * | poly | ) |
Free a polynomial and return NULL.
[in,out] | poly | The polynomial to be free. |
int mbs_polynomial_eval | ( | MbsPolynomial * | poly, |
double | x, | ||
double * | y, | ||
int | deriv | ||
) |
Evaluate the polynomial (or its nth derivative) at the provided coordinate.
[in] | poly | The polynomial of the function. |
[in] | x | The coordinate at which the the function must be computed. |
[out] | y | The pointer to store the function value. |
[in] | deriv | The order of the derivative to be computed. The function is 0, the first derivative is 1... |
int mbs_polynomial_eval_vec | ( | MbsPolynomial * | poly, |
int | nx, | ||
double * | vx, | ||
double ** | p_vy, | ||
int | deriv | ||
) |
Evaluate the polynomial (or its nth derivative) at the provided coordinates vector.
[in] | poly | The polynomial of the function. |
[in] | nx | The number of coordinate to be evaluated. |
[in] | vx | The array containing the coordinates at which the the function must be computed. |
[in,out] | p_vy | The pointer to array where the output array pointer is located. if it contains a NULL adress, the output array is allocated. |
[in] | deriv | The order of the derivative to be computed. The function is 0, the first derivative is 1... |
MbsPolynomial* mbs_polynomial_new | ( | int | order | ) |
Allocate a polynomial.
If order is negative, pointer is set to NULL.
[in] | order | The order of the polynomial. A negative value means that the coefficient array is not allocated. |
int mbs_polynomial_print | ( | MbsPolynomial * | poly | ) |
Print information about the polynomial.
[in] | poly | The polynomial. |