Linux Assemblycollection of fast libraries

Approximation libraryApproximation.h

The need for function approximations arises in many branches of applied mathematics, and computer science in particular. In general, a function approximation problem asks us to select a function among a well-defined class that closely matches a target function in a task-specific way. In mathematics, the idea of least squares can be applied to approximating a given function by a weighted sum of other functions. The best approximation can be defined as that which minimises the difference between the original function and the approximation; for a least-squares approach the quality of the approximation is measured in terms of the squared differences between the two.

This library implements different function cores to approximate existing empirical data or time series by well known analytic functions, such as polynomial, exponential, hyperbolic, power and much complex composite functions (see the full list below).

Contents

Function list

C function nameFunctionsC++ function nameFunctions
ArcCosH2 functionsArcCosH2 functions
ArcSinH2 functionsArcSinH2 functions
CosH2 functionsCosH2 functions
Cube2 functionsCube2 functions
Exp2 functionsExp2 functions
Hyperbolic2 functionsHyperbolic2 functions
InverseCube2 functionsInverseCube2 functions
InverseSquare2 functionsInverseSquare2 functions
Linear2 functionsLinear2 functions
Log2 functionsLog2 functions
PolyArcCosH2 functionsPolyArcCosH2 functions
PolyArcSinH2 functionsPolyArcSinH2 functions
PolyCosH2 functionsPolyCosH2 functions
PolyExp2 functionsPolyExp2 functions
PolyLog2 functionsPolyLog2 functions
PolySinH2 functionsPolySinH2 functions
PolySqrt2 functionsPolySqrt2 functions
Polynomial2 functionsPolynomial2 functions
Power2 functionsPower2 functions
Rational2 functionsRational2 functions
SinH2 functionsSinH2 functions
Sqrt2 functionsSqrt2 functions
Square2 functionsSquare2 functions
Subrational2 functionsSubrational2 functions
C function nameFunctionsC++ function nameFunctions

Approximation by power function

Cbool Approximation_Power_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Power_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Power (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Power (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the power function of type y(x) = a * xb and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Approximation by elementary functions

Elementary functions may clearly describe most of empirical data you get in real life or measure in different experiments. You may need simple approximation rules for these data, which may be covered by very simple mathematical expressions, are implemented below.

Linear approximation

Cbool Approximation_Linear_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Linear_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Linear (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Linear (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the linear function of type y(x) = a + b * x1 and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Square law approximation

Cbool Approximation_Square_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Square_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Square (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Square (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the square law function of type y(x) = a + b * x2 and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Cube law approximation

Cbool Approximation_Cube_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Cube_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Cube (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Cube (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the cube law function of type y(x) = a + b * x3 and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Hyperbolic approximation

Cbool Approximation_Hyperbolic_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Hyperbolic_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Hyperbolic (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Hyperbolic (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the hyperbolic function of type y(x) = a + b / x1 and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Inverse square law approximation

Cbool Approximation_InverseSquare_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_InverseSquare_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::InverseSquare (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::InverseSquare (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the inverse square law function of type y(x) = a + b / x2 and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Inverse cube law approximation

Cbool Approximation_InverseCube_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_InverseCube_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::InverseCube (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::InverseCube (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the inverse cube law function of type y(x) = a + b / x3 and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Square root approximation

Cbool Approximation_Sqrt_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Sqrt_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Sqrt (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Sqrt (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the square root function of type y(x) = a + b * Sqrt (x) and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Exponential approximation

Cbool Approximation_Exp_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Exp_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Exp (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Exp (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the exponential function of type y(x) = a + b * Exp (x) and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Logarithmic approximation

Cbool Approximation_Log_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Log_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Log (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Log (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the logarithmic function of type y(x) = a + b * Log (x) and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Hyperbolic sine approximation

Cbool Approximation_SinH_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_SinH_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::SinH (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::SinH (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the hyperbolic sine function of type y(x) = a + b * SinH (x) and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Hyperbolic cosine approximation

Cbool Approximation_CosH_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_CosH_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::CosH (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::CosH (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the hyperbolic cosine function of type y(x) = a + b * CosH (x) and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Inverse hyperbolic sine approximation

Cbool Approximation_ArcSinH_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_ArcSinH_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::ArcSinH (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::ArcSinH (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the inverse hyperbolic sine function of type y(x) = a + b * ArcSinH (x) and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Inverse hyperbolic cosine approximation

Cbool Approximation_ArcCosH_flt32 (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_ArcCosH_flt64 (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::ArcCosH (flt32_t coeff[], flt32_t matrix[], flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::ArcCosH (flt64_t coeff[], flt64_t matrix[], flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the inverse hyperbolic cosine function of type y(x) = a + b * ArcCosH (x) and return best fit coefficients (a, b) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least 2 elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least 4 elements)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Approximation by polynomial functions

Complex data with curves require much complex approximation rules, which may be expressed by polynomial based functions. Polynomials of high degree is good idea to try to approximate empirical data with unknown relations between argument and derivative values.

Polynomial approximation

Cbool Approximation_Polynomial_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Polynomial_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Polynomial (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Polynomial (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the polynomial function of type y(x) = a0*x0 + a1*x1 + a2*x2 + ... + an*xn, where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Square root approximation

Cbool Approximation_PolySqrt_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_PolySqrt_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::PolySqrt (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::PolySqrt (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the square root polynomial function of type y(x) = Sqrt (a0*x0 + a1*x1 + a2*x2 + ... + an*xn), where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Exponential approximation

Cbool Approximation_PolyExp_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_PolyExp_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::PolyExp (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::PolyExp (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the exponential polynomial function of type y(x) = Exp (a0*x0 + a1*x1 + a2*x2 + ... + an*xn), where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Logarithmic approximation

Cbool Approximation_PolyLog_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_PolyLog_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::PolyLog (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::PolyLog (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the logarithmic polynomial function of type y(x) = Log (a0*x0 + a1*x1 + a2*x2 + ... + an*xn), where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Hyperbolic sine approximation

Cbool Approximation_PolySinH_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_PolySinH_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::PolySinH (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::PolySinH (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the hyperbolic sine polynomial function of type y(x) = SinH (a0*x0 + a1*x1 + a2*x2 + ... + an*xn), where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Hyperbolic cosine approximation

Cbool Approximation_PolyCosH_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_PolyCosH_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::PolyCosH (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::PolyCosH (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the hyperbolic cosine polynomial function of type y(x) = CosH (a0*x0 + a1*x1 + a2*x2 + ... + an*xn), where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Inverse hyperbolic sine approximation

Cbool Approximation_PolyArcSinH_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_PolyArcSinH_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::PolyArcSinH (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::PolyArcSinH (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the inverse hyperbolic sine polynomial function of type y(x) = ArcSinH (a0*x0 + a1*x1 + a2*x2 + ... + an*xn), where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Inverse hyperbolic cosine approximation

Cbool Approximation_PolyArcCosH_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_PolyArcCosH_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::PolyArcCosH (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::PolyArcCosH (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the inverse hyperbolic cosine polynomial function of type y(x) = ArcCosH (a0*x0 + a1*x1 + a2*x2 + ... + an*xn), where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Approximation by rational functions

Rational functions are generalization of polynomials. Some data may need this type of approximation instead of polynomial approximation.

Rational function approximation

Cbool Approximation_Rational_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Rational_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Rational (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Rational (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the rational function of type y(x) = 1 / (a0*x0 + a1*x1 + a2*x2 + ... + an*xn), where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.

Subrational function approximation

Cbool Approximation_Subrational_flt32 (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation_Subrational_flt64 (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);
C++bool Approximation::Subrational (flt32_t coeff[], flt32_t matrix[], size_t degree, flt32_t args[], flt32_t vals[], flt32_t temp[], size_t size);
bool Approximation::Subrational (flt64_t coeff[], flt64_t matrix[], size_t degree, flt64_t args[], flt64_t vals[], flt64_t temp[], size_t size);

Description: Try to approximate the empirical data by the subrational function of type y(x) = a0/x0 + a1/x1 + a2/x2 + ... + an/xn, where n is polynomial degree, and return best fit coefficients (a0, a1, a2, ..., an) into coefficients array.

Parameters:

  • coeff - pointer to array where the functions return found approximation coefficients (should be able to hold at least [degree+1] elements)
  • matrix - pointer to temporary buffer is used for internal matrix coefficient (should be able to hold at least [degree+1]2 elements)
  • degree - polynomial degree (can be zero)
  • args - pointer to array which holds empirical data arguments (i.e. X axis)
  • vals - pointer to array which holds empirical data values (i.e. Y axis)
  • temp - pointer to temporary buffer is used for internal data transformation (should be able to hold at least "size" elements)
  • size - size of empirical data arrays (count of elements)

Return value:

  • TRUE (1) by default.
  • FALSE (0) if size of empirical data arrays is equal to zero, or an error occurred during matrix solving process.
Copyright 2012-2016 Jack Black. All rights reserved.