Data Structures | |
| struct | VCPolynom1D1D |
| 1D->1D Polynomial Representation More... | |
Functions | |
| I32 | vc_poly1d1d_allocate (VCPolynom1D1D *poly, I32 order) |
| Allocates memory for a VCPolynom1D1D structure. More... | |
| void | vc_poly1d1d_free (VCPolynom1D1D *poly) |
| Frees a previously allocated VCPolynom1D1D structure. More... | |
| I32 | vc_poly1d1d_map (F64 xIn, F64 *yOut, VCPolynom1D1D *poly) |
| Calculates a result using a VCPolynom1D1D structure. More... | |
| I32 | vc_poly1d1d_copy (VCPolynom1D1D *polyFrom, VCPolynom1D1D *polyTo) |
| Copies a VCPolynom1D1D structure. More... | |
| void | vc_poly1d1d_print (VCPolynom1D1D *poly, I32 indentation) |
| Prints out a VCPolynom1D1D struct. More... | |
| I32 | vc_poly1d1d_derive_and_allocate (VCPolynom1D1D *polyDerivative, VCPolynom1D1D *polyFrom) |
| Derives and allocates from a given polynomial. More... | |
| I32 | vc_poly1d1d_zero_crossing (VCPolynom1D1D *poly, F64 *xZero, F64 xStart, F64 maxDev, I32 maxSteps) |
| Get a Zero of a Polynomial by Newton's Method. More... | |
| I32 | vc_poly1d1d_line_intersection (point *pt, F64 xStart, VCPolynom1D1D *poly, vcline *l, F64 maxDev, I32 maxSteps) |
| Get an Intersection Point of Polynomial with a Line by Newton's Method. More... | |
| I32 | vc_poly1d1d_load_and_allocate_from_ini (VCPolynom1D1D *poly, char *filename, I8 tiCompatibleIff1) |
| Reads and allocates a VCPolynom1D1D struct from an INI file. More... | |
| I32 | vc_poly1d1d_store_as_ini (char *filename, VCPolynom1D1D *poly, I8 tiCompatibleIff1) |
| Stores VCPolynom1D1D struct values as INI file. More... | |
| struct VCPolynom1D1D |
This struct represents a polynomial of order N defined as follows:
Due to numerical stability at the polynomial estimation, there may be transforms which are additionally done instead of inherently at the polynomial itself:
If the value of transformInIff1 is 1, the polynomials input value x is calculated from given xInput as pre-transform by the following formula:
Likewise if the value of transformOutIff1 is 1, the polynomials output value Y is post-transformed to the result YOutput by the following formula:
| Data Fields | ||
|---|---|---|
| I32 | order |
Maximum order in polynomial for calculating Y(x). |
| F64 * | coeff |
Coefficients of polynomial for calculating Y(x). |
| I32 | transformInIff1 |
If 1, prior to application of the input value to the polynomial it is transformed: in = (in - offsIn) / scaleIn. |
| F64 | offsIn |
Offset for Input Value. |
| F64 | scaleIn |
Scale Factor for Input Value. |
| I32 | transformOutIff1 |
If 1, after mapping through the polynomial the output value is transformed: out = (out * scaleOut) + offsOut. |
| F64 | offsOut |
Offset for Output Value. |
| F64 | scaleOut |
Scale Factor for Output Value. |
| I32 vc_poly1d1d_allocate | ( | VCPolynom1D1D * | poly, |
| I32 | order | ||
| ) |
The function allocates memory for a VCPolynom1D1D structure.
| poly | The polynom struct with internals to be allocated. |
| order | The maximum order of the polynom . |
| ERR_NONE | on Success. |
| ERR_PARAM | if order is malformed. |
| ERR_MEMORY | if memory allocation fails. |
| void vc_poly1d1d_free | ( | VCPolynom1D1D * | poly | ) |
The function frees a previously allocated VCPolynom1D1D structure.
| poly | The polynom struct to be freed. |
| I32 vc_poly1d1d_map | ( | F64 | xIn, |
| F64 * | yOut, | ||
| VCPolynom1D1D * | poly | ||
| ) |
The function calculates a result using a VCPolynom1D1D structure.
| poly | The polynom struct. |
| xIn | Input Value for the polynom poly. |
| yOut | Output Value of the polynom poly. |
| ERR_NONE | on Success. |
| ERR_SINGULAR | if transformInIff1 is 1 and scaleX/YIn is 0. |
| I32 vc_poly1d1d_copy | ( | VCPolynom1D1D * | polyFrom, |
| VCPolynom1D1D * | polyTo | ||
| ) |
The function copies a VCPolynom1D1D structure to another.
| polyFrom | The polynom struct with internals to be copied from. |
| polyTo | The polynom struct with internals to be copied to. |
| ERR_NONE | on Success. |
| ERR_INCONS | if order differs. |
| ERR_MEMORY | if any polynomial is not allocated. |
| void vc_poly1d1d_print | ( | VCPolynom1D1D * | poly, |
| I32 | indentation | ||
| ) |
This function prints out a VCPolynom1D1D struct.
| poly | The polynom struct. |
| I32 vc_poly1d1d_derive_and_allocate | ( | VCPolynom1D1D * | polyDerivative, |
| VCPolynom1D1D * | polyFrom | ||
| ) |
The function allocates memory for a VCPolynom1D1D structure which represents the derivative of a given polynomial. Pre- and post transformation information is applied accordingly.
| polyDerivative | The internally allocated derivate polynom. |
| poly | The polynom struct to be derived from. |
| I32 vc_poly1d1d_zero_crossing | ( | VCPolynom1D1D * | poly, |
| F64 * | xZero, | ||
| F64 | xStart, | ||
| F64 | maxDev, | ||
| I32 | maxSteps | ||
| ) |
| poly | The polynom struct to be derived from. |
| xZero | The zero x-position result. |
| xStart | Beginning of the walk, should be near the zero crossing, if there are more than one zero, the value of this parameter determines the xZero candidate. |
| maxDev | Zero is found, if the function value falls below this. |
| maxSteps | Limits the search duration. |
| ERR_PARAM | if deriving or mapping fails. |
| ERR_SINGULAR | if derivate is zero. |
| ERR_OVERRUN | if maxSteps is exceeded. |
| I32 vc_poly1d1d_line_intersection | ( | point * | pt, |
| F64 | xStart, | ||
| VCPolynom1D1D * | poly, | ||
| vcline * | l, | ||
| F64 | maxDev, | ||
| I32 | maxSteps | ||
| ) |
| pt | The intersection result. |
| xStart | Beginning of the walk, if there are more than one intersection, the value of this parameter determines the pt candidate. |
| poly | The polynom struct to be intersected. |
| l | The line to be intersected. |
| maxDev | The intersection is found, if the function value falls below this. |
| maxSteps | Limits the search duration. |
| ERR_PARAM | if deriving or mapping fails. |
| ERR_SINGULAR | if derivate is zero. |
| ERR_OVERRUN | if maxSteps is exceeded. |
| I32 vc_poly1d1d_load_and_allocate_from_ini | ( | VCPolynom1D1D * | poly, |
| char * | filename, | ||
| I8 | tiCompatibleIff1 | ||
| ) |
This function reads and allocates a VCPolynom1D1D struct from an INI file.
| filename | The input INI file. |
| poly | The unallocated output polynom struct, on success it is allocated, free with vc_poly1d1d_free(). |
| tiCompatibleIff1 | Use the same value at writing: If set to 1, the ini file can be interchanged between ARM and TI. On TI based platforms, this value has to be 1. |
| ERR_NONE | on Success. |
| <0 | on Error, especially ERR_FIO if file reading fails, either by missing entries, or by opening. |
| I32 vc_poly1d1d_store_as_ini | ( | char * | filename, |
| VCPolynom1D1D * | poly, | ||
| I8 | tiCompatibleIff1 | ||
| ) |
This function stores VCPolynom1D1D struct values as INI file.
| filename | The output INI file. |
| poly | The polynom struct. |
| tiCompatibleIff1 | Use the same value at reading: If set to 1, the ini file can be interchanged between ARM and TI. On TI based platforms, this value has to be 1. |
| ERR_NONE | on Success. |
| <0 | on Error, especially (-10 + 100 * vcmenu_store_values_in_file()). |