Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

How to tranfer saved "scoeff" to 'dfdInterpolate1D' to calculate interpolated results?

H__Bin
Beginner
734 Views

Dear all,

In curve fitting, suppose I already have "scoeff" from previous data fitting and the data fitting task  is already deleted.

How can I pass the saved "scoeff" to "dfdInterpolate1D" later to calculate interpolated results whenever necessary ?  Can it be simpler and don't need to supply x and y,  and don't need to calculate "scoeff" again?

Thank you very much!

 

 

0 Kudos
8 Replies
Khang_N_Intel
Employee
734 Views

Hi Bin,

Thank you for posting.

We will take a look and will get back to you.

Best regards,

Khang

0 Kudos
Khang_N_Intel
Employee
734 Views

Hi Bin,

The saved "coeff" can be passed using the df?EditPPSpline1D function as the “scoeff” parameter.

X and Y data shall be set to the Data Fitting task. This data is used during interpolation.

Hope this helps!

Khang

0 Kudos
H__Bin
Beginner
734 Views

Thank you! Khang

But I think the df?EditPPSpline1D function will generate a new "coeff" from X and Y data. And my saved "coeff" will be replaced. 

Is that right?

How to make the interpolation task to use my "coeff" instead of the new "coeff" generated from that X and Y data?

Thank you very much!I

0 Kudos
Pavel_D_Intel1
Employee
734 Views

Hi Bin,

two different scenarios for interpolation routine are supported by Intel® MKL Data Fitting library:

Scenario 1.

  • Create new Data Fitting task
  • Set all spline’s parameters and pointer to the memory storage as a “scoeff” parameter by df?EditPPSpline1D function
  • Call df?Construct1D function to construct spline. Spline’s coefficients are saved to the “scoeff” memory storage
  • Call df?Interpolate1D function to run spline-based interpolation

Scenario 2.

  • Create new Data Fitting task
  • Set spline’s parameters and pointer to the precomputed spline coefficients as “scoeff” parameter by df?EditPPSpline1D function (without spline reconstruction)
  • Call df?Interpolate1D function to run spline-based interpolation

For your case the second described interpolation scenario can be used to utilize precomputed splines’ coefficients.

Feel free to ask in case of any questions.

Best regards,

Pavel.

0 Kudos
H__Bin
Beginner
734 Views

Dear Sir,

Can I ask more questions?  Which spline data-fitting function can generate similar results with the MATLAB function 'spline'?

Because when I modified MKL example 'dfdcubicspline_interp.c' and used the same data with MATLAB function 'spline', I got different spline coefficients “scoeff”.  

Which function should I use or what parameters should I use to be comparable to MATLAB function 'spline'?

Thank you very much!

 

 

0 Kudos
Pavel_D_Intel1
Employee
734 Views

Hi Bin,

Spline’s coefficients are highly depend on the spline’s type and spline’s boundary conditions.

MATLAB’s documentation appears not to provide information about spline’s type used underneath “spline” function.

We however assume that natural cubic spline with not-a-knot boundary conditions might be possible option.
 

To construct natural cubic splines with not-a-knot boundary conditions, please call the editor of the Data Fitting task and then construct the spline as shown below:

df?EditPPSpline1D( task, DF_PP_CUBIC, DF_PP_NATURAL, DF_BC_NOT_A_KNOT, 0, DF_NO_IC, 0, scoeff, scoeffhint);

df?Construct1D( task, DF_PP_SPLINE, DF_METHOD_STD );

 

Please, let me know, if it addresses your request. Feel free to ask more questions about Data Fitting component of Intel® MKL.
Best regards,
Pavel.

0 Kudos
H__Bin
Beginner
734 Views

Dear Pavel,

I want to ask a question, can I pack different parameters together as y vector, and get different coeff for several curves on one task?  For example, I want to do data fitting for x vs y1, x vs y2, x vs y3, can I pack the data of y1, y2 and y3 together as a vector y, and obtain three curves at the same time ?  Do you have examples for these multiple curve fitting?

Thank you very much!

 

 

 

Dyakov, Pavel (Intel) wrote:

Please, let me know, if it addresses your request. Feel free to ask more questions about Data Fitting component of Intel® MKL.

Best regards,
Pavel.

0 Kudos
Pavel_D_Intel1
Employee
734 Views

Hi Bin,

Data Fitting tasks support simultaneous work with the different curves, e.g. you can construct the splines for y1, y2, y3 sets at the same time.
Functions' values can be packed "set by set" to the vector y.  Please find the example:

 

int i, j;
double freq;
for( i = 0; i < ny; i++ )
{
               freq = (i + 1);
               for( j = 0; j < nx; j++ )
               {
                              y[i*nx+j]= sin(x*freq);
               }
}                            

Where:                nx – size of partition x
                            ny – function dimension

 

This approach is also demonstrated in dfdlinearspline example (with ny = 2).

Hope this helps. Will be glad to help you in case of more Data Fitting questions.

Best regards,
Pavel.

0 Kudos
Reply