VCLib Documentation  6.12.2

2D->1D Polynomial

2D->1D Polynomial

Data Structures

struct  VCPolynom2D1D
 2D->1D Polynomial Representation More...
 

Functions

I32 vc_poly2d1d_allocate (VCPolynom2D1D *poly, I32 order, I32 orderRestrictedIff1)
 Allocates memory for a VCPolynom2D1D structure. More...
 
void vc_poly2d1d_free (VCPolynom2D1D *poly)
 Frees a previously allocated VCPolynom2D1D structure. More...
 
I32 vc_poly2d1d_map (F64 xIn, F64 yIn, F64 *zOut, VCPolynom2D1D *poly)
 Calculates a result using a VCPolynom2D1D structure. More...
 
I32 vc_poly2d1d_copy (VCPolynom2D1D *polyFrom, VCPolynom2D1D *polyTo)
 Copies a VCPolynom2D1D structure. More...
 
void vc_poly2d1d_print (VCPolynom2D1D *poly, I32 indentation)
 Prints out a VCPolynom2D1D struct. More...
 
I32 vc_poly2d1d_load_and_allocate_from_ini (VCPolynom2D1D *poly, char *filename, I8 tiCompatibleIff1)
 Reads and allocates a VCPolynom2D1D struct from an INI file. More...
 
I32 vc_poly2d1d_store_as_ini (char *filename, VCPolynom2D1D *poly, I8 tiCompatibleIff1)
 Stores VCPolynom2D1D struct values as INI file. More...
 
I32 vc_poly2d1d_pow_to_idx (I32 *idx, I32 powX, I32 powY, VCPolynom2D1D *poly)
 Returns the index number of the coeff of specific powers. More...
 
I32 vc_poly2d1d_idx_to_pow (I32 *powX, I32 *powY, I32 idx, VCPolynom2D1D *poly)
 Returns the powers represented by the index of the coeff VCPolynom2D1D structure. More...
 
I32 vc_poly2d1d_total_cnt_coeff (I32 *cntCoeff, VCPolynom2D1D *poly)
 Returns the number of values at the coeff array. More...
 

Detailed Description


Data Structure Documentation

◆ VCPolynom2D1D

struct VCPolynom2D1D

This struct represents a polynomial of order N defined as follows:

  • if 1 != orderRestrictedIff1:

    \begin{eqnarray*}\begin{array}{rccccccc} Z(x,y) = & c_{00} x^{0} y^{0} &+& c_{01} x^{0} y^{1} &+& \dots &+& c_{0N} x^{0} y^{N} \\ + & c_{10} x^{1} y^{0} &+& c_{11} x^{1} y^{1} &+& \dots &+& c_{1N} x^{1} y^{N} \\ & \vdots & & \vdots & & \vdots && \vdots \\ + & c_{N0} x^{N} y^{0} &+& c_{N1} x^{N} y^{1} &+& \dots &+& c_{NN} x^{N} y^{N} \\ \end{array} \end{eqnarray*}

  • if 1 == orderRestrictedIff1, using $ A:= B-N$ and $B:= ((N+1)*(N+2))/2$ :

    \begin{eqnarray*}\begin{array}{rl} Z(x,y) = & c_{0} x^{0} y^{0} \\ + & c_{1} x^{1} y^{0} + c_{2} x^{0} y^{1} \\ + & c_{3} x^{2} y^{0} + c_{4} x^{1} y^{1} + c_{5} x^{0} y^{2} \\ + & \dots \\ + & c_{A} x^{N} y^{0} + c_{A+1} x^{N-1} y^{1} + \dots + c_{B} x^{0} y^{N} \\ \end{array} \end{eqnarray*}

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 values x and y are calculated from given xInput and yInput as pre-transform by the following formula:

\begin{eqnarray*}\begin{array}{rl} x &= (xInput - offsInX) / scaleInX \\ y &= (yInput - offsInY) / scaleInY \\ \end{array}\end{eqnarray*}

Likewise if the value of transformOutIff1 is 1, the polynomial's output value Z is post-transformed to the result ZOutput by the following formula:

\begin{eqnarray*}\begin{array}{rl} ZOutput &= (Z * scaleZOut) + offsZOut \\ \end{array}\end{eqnarray*}

Data Fields
I32 orderRestrictedIff1

If 1, per coefficient sum of orders of x and y is smaller or equals orderX or orderY, see description.

I32 order

Maximum order in polynomial for calculating Z(x,y).

F64 * coeff

Coefficients of polynomial for calculating X(x,y).

I32 transformInIff1

If 1, prior to application of the input value to the polynomial it is transformed: in = (in - offsIn) / scaleIn.

F64 offsXIn

Offset for Input Value X Component.

F64 offsYIn

Offset for Input Value Y Component.

F64 scaleXIn

Scale Factor for Input Value X Component.

F64 scaleYIn

Scale Factor for Input Value Y Component.

I32 transformOutIff1

If 1, after mapping through the polynomial the output value is transformed: out = (out * scaleOut) + offsOut.

F64 offsZOut

Offset for Output Value.

F64 scaleZOut

Scale Factor for Output Value.

Function Documentation

◆ vc_poly2d1d_allocate()

I32 vc_poly2d1d_allocate ( VCPolynom2D1D poly,
I32  order,
I32  orderRestrictedIff1 
)

The function allocates memory for a VCPolynom2D1D structure.

Parameters
polyThe polynom struct with internals to be allocated.
orderThe maximum order of the polynom $Z(x,y)$.
orderRestrictedIff1Selects which type of coefficients are available, see VCPolynom2D1D for an explanation.
Return values
ERR_NONEon Success.
ERR_PARAMif order is malformed.
ERR_MEMORYif memory allocation fails.
See also
vc_poly2d1d_free().

◆ vc_poly2d1d_free()

void vc_poly2d1d_free ( VCPolynom2D1D poly)

The function frees a previously allocated VCPolynom2D1D structure.

Parameters
polyThe polynom struct to be freed.
See also
vc_poly2d1d_allocate().

◆ vc_poly2d1d_map()

I32 vc_poly2d1d_map ( F64  xIn,
F64  yIn,
F64 zOut,
VCPolynom2D1D poly 
)

The function calculates a result using a VCPolynom2D1D structure.

Parameters
polyThe polynom struct with internals to be allocated.
xIn,yInInput Values $x$ and $y$ for the polynom poly.
zOutOutput Value $Z(x,y)$ of the polynom poly.
Return values
ERR_NONEon Success.
ERR_SINGULARif transformInIff1 is 1 and scaleX/YIn is 0.
See also
vc_poly2d1d_total_cnt_coeff(), vc_poly2d1d_idx_to_pow(), vc_poly2d1d_pow_to_idx().

◆ vc_poly2d1d_copy()

I32 vc_poly2d1d_copy ( VCPolynom2D1D polyFrom,
VCPolynom2D1D polyTo 
)

The function copies a VCPolynom2D1D structure to another.

Parameters
polyFromThe polynom struct with internals to be copied from.
polyToThe polynom struct with internals to be copied to.
Return values
ERR_NONEon Success.
ERR_INCONSif order differs.
ERR_MEMORYif any polynomial is not allocated.
See also
vc_poly2d1d_allocate().

◆ vc_poly2d1d_print()

void vc_poly2d1d_print ( VCPolynom2D1D poly,
I32  indentation 
)

This function prints out a VCPolynom2D1D struct.

Parameters
polyThe polynom struct.

◆ vc_poly2d1d_load_and_allocate_from_ini()

I32 vc_poly2d1d_load_and_allocate_from_ini ( VCPolynom2D1D poly,
char *  filename,
I8  tiCompatibleIff1 
)

This function reads and allocates a VCPolynom2D1D struct from an INI file.

Parameters
filenameThe input INI file.
polyThe unallocated output polynom struct, on success it is allocated, free with vc_poly2d1d_free().
tiCompatibleIff1Use 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.
Return values
ERR_NONEon Success.
<0on Error, especially ERR_FIO if file reading fails, either by missing entries, or by opening.
See also
vc_poly2d1d_store_as_ini().

◆ vc_poly2d1d_store_as_ini()

I32 vc_poly2d1d_store_as_ini ( char *  filename,
VCPolynom2D1D poly,
I8  tiCompatibleIff1 
)

This function stores VCPolynom2D1D struct values as INI file.

Parameters
filenameThe output INI file.
polyThe polynom struct.
tiCompatibleIff1Use 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.
Return values
ERR_NONEon Success.
<0on Error, especially (-32 + 100 * vcmenu_store_values_in_file()).
See also
vc_poly2d1d_load_and_allocate_from_ini().

◆ vc_poly2d1d_pow_to_idx()

I32 vc_poly2d1d_pow_to_idx ( I32 idx,
I32  powX,
I32  powY,
VCPolynom2D1D poly 
)

If the powers $powX$ and $powY$ for the coeff is given, this function determines the index idx of the coeff. The function vc_poly2d1d_idx_to_pow() is reverse.

Parameters
idxOutput Index for estimating powers for.
powX,powYInput Powers $ c_{idx} x^{powX} y^{powY}$.
polyThe polynom struct.
Return values
ERR_PARAMif order is malformed.
See also
vc_poly2d1d_total_cnt_coeff(), vc_poly2d1d_idx_to_pow(), vc_poly2d1d_pow_to_idx().

◆ vc_poly2d1d_idx_to_pow()

I32 vc_poly2d1d_idx_to_pow ( I32 powX,
I32 powY,
I32  idx,
VCPolynom2D1D poly 
)

If an index idx for the coeff is given, this function determines the powers of the $x$ and $y$ variables. The function vc_poly2d1d_pow_to_idx() is reverse.

Parameters
powX,powYOutput Powers $ c_{idx} x^{powX} y^{powY}$, if not needed, set to NULL.
idxInput Index for estimating powers for.
polyThe polynom struct.
Return values
ERR_NONEon Success.
See also
vc_poly2d1d_total_cnt_coeff(), vc_poly2d1d_idx_to_pow(), vc_poly2d1d_pow_to_idx().

◆ vc_poly2d1d_total_cnt_coeff()

I32 vc_poly2d1d_total_cnt_coeff ( I32 cntCoeff,
VCPolynom2D1D poly 
)

This function returns the number of values at the coeff array.

Parameters
cntCoeffOutput number, if not needed, set to NULL.
polyThe polynom struct.
See also
vc_poly2d1d_total_cnt_coeff(), vc_poly2d1d_idx_to_pow(), vc_poly2d1d_pow_to_idx().