Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- MKL - General Polynomial Fitting function?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

LWang77

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2019
08:40 PM

442 Views

MKL - General Polynomial Fitting function?

Hi,

I’m looking for a general Polynomial Fitting function in **MKL**, which is similar to **Polyfit **function from **Matlab**, **OptiVec **and **Armadillo**. This function uses two set of input data X and Y to determine the coefficients a_{i} of a polynomial:

P_{i }= a_{0} + a_{1}X_{i} + a_{2}X_{i}^{2} ... a_{n}X_{i}^{n}

Where,

χ^{2} = sum( 1/σ_{i}^{2} * (P_{i} - Y_{i})^{2 });

Is minimized.

I have searched MKL **Data Fitting **Library and found that all of routines are **Spline**-based. In MKL **LAPACK **library, I found some routines the **Least Squares** ones.

I understand that,

- as the order of the polynomial increases,
**Spline**-based methods are preferable over polynomial interpolation because its interpolation error increases - when the number of points of X and Y > (1 + the degree) of the polynomial to be used, the
**Least Squares**fit will be used

However, what I’m looking for is a general Polynomial Fitting function described above. Is there such function in MKL? Where can I find it in MKL (or IPP)?

Link Copied

3 Replies

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-20-2019
09:18 PM

442 Views

The Matlab **polyfit** routine is restricted to fitting with uniform weighting, i.e., σ_{i} is the same for all *i*. This capability is available in Lapack, in the subroutine ?GELS.

There is no ready-to-use-routine for the non-uniform weights case in MKL, as far as I know, but you should be able to put one together using the matrix manipulation routines that are available in BLAS/Lapack.

LWang77

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-21-2019
03:05 PM

442 Views

Thank you for your advice, mecej4!

According to the MKL Reference, the function **?gels**

*Uses QR or LQ factorization to solve a overdetermined or underdetermined linear system with full rank matrix.*

The uniform weighting is ok for our application. In addition to the Least Squares fit, however, we are looking for Polynomial Fitting function that determine the coefficients of a polynomial for:

Number of input points **= **(1 + degree) of the polynomial to be used

Is there such Polynomial Fitting function in **MKL **(or **IPP**)? In other words, we need to calculate the coefficients of a polynomial that neither **overdetermined **nor **underdetermined**.

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-22-2019
03:51 AM

442 Views

The interpolating polynomial can be obtained in the Lagrange form explicitly, without any matrix algebra. See https://en.wikipedia.org/wiki/Lagrange_polynomial .

If the coefficients are desired, rather than interpolants, you may use the Lapack routine ?GESV, which is available in MKL.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.