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

## MKL data fitting - boundary conditions for quadratic spline interpolation Beginner
665 Views

Hello All,

I'm quite new on using MKL data fitting function. I'm working with Visual Fortran and I have the 64bit MKL library - Version 2019.0.5.
I need to use the quadratic spline interpolation so I followed the relevant installed example (\mkl\examples\datafittingf\source\dfdquadraticspline.f) as well as the reference manual.
My issues are about the boundary conditions:
1. My first choice was setting bc_type = DF_NO_BC, but this gave me an error, although from the manual seems this option is allowed for all type of spline. Is there any possibility to not provide boundary conditions quadratic splines ?
2. In the mkl example is used bc_type = DF_BC_Q_VAL and with bc(1) = 1.0. In the manual is written the boundary condition value must be the Function value at point (x0 + x1)/2, when bc_type = DF_BC_Q_VAL, but I only have the function samples at breakpoints, how I can handle this case ?
3. If boundary conditions are mandatory, how can set them when the number of function to interpolate is greater than one (NNY > 1) ? For example, if I have two functions should I size bc(2) and put the bc of the first function in bc(1) and the bc of the second function in bc(2) ?

Best regards
Paolo

1 Solution Employee
645 Views

Hi Paolo,

Default quadratic splines support only DF_BC_Q_VAL boundary conditions type.

>> My first choice was setting bc_type = DF_NO_BC, but this gave me an error, although from the manual seems this option is allowed for all type of spline.

We will improve our oneMKL Data Fitting developer reference manual in the future releases. Thank you for finding an incorrect description!

>> In the manual is written the boundary condition value must be the Function value at point (x0 + x1)/2, when bc_type = DF_BC_Q_VAL, but I only have the function samples at breakpoints, how I can handle this case ?

I could suggest to use the another interpolation type to find this value (e.g. you can simply use linear interpolant).

>> If boundary conditions are mandatory, how can set them when the number of function to interpolate is greater than one (NNY > 1) ? For example, if I have two functions should I size bc(2) and put the bc of the first function in bc(1) and the bc of the second function in bc(2)

Size of bc array in case of DF_BC_Q_VAL is 1. Boundary conditions (the same as internal conditions) are applied for each coordinate of the vector-valued function.

Best regards,
Pavel

3 Replies Employee
646 Views

Hi Paolo,

Default quadratic splines support only DF_BC_Q_VAL boundary conditions type.

>> My first choice was setting bc_type = DF_NO_BC, but this gave me an error, although from the manual seems this option is allowed for all type of spline.

We will improve our oneMKL Data Fitting developer reference manual in the future releases. Thank you for finding an incorrect description!

>> In the manual is written the boundary condition value must be the Function value at point (x0 + x1)/2, when bc_type = DF_BC_Q_VAL, but I only have the function samples at breakpoints, how I can handle this case ?

I could suggest to use the another interpolation type to find this value (e.g. you can simply use linear interpolant).

>> If boundary conditions are mandatory, how can set them when the number of function to interpolate is greater than one (NNY > 1) ? For example, if I have two functions should I size bc(2) and put the bc of the first function in bc(1) and the bc of the second function in bc(2)

Size of bc array in case of DF_BC_Q_VAL is 1. Boundary conditions (the same as internal conditions) are applied for each coordinate of the vector-valued function.

Best regards,
Pavel Beginner
626 Views

Thank you very much Pavel.

Best Regards

Paolo Moderator
642 Views

The documentation would be improved and this thread would be updated asap. 