DataFitting question

DataFitting question

Hi, In MKL documentaion (, 'Boundary Conditions Supported by Data Fitting Functions' says 'DF_BC_1ST_LEFT_DER' is 'The first derivative at the left endpoint is zero.'. Then what does this 'is zero' mean ?
I actually tried  NATURAL spline with DF_BC_1ST_LEFT_DER|DF_BC_1ST_RIGHT_DER options(etc),and got different results for non zero boundary values. 

I also tried LINEAR spline with/without PERIODIC option, and it showed no difference even in the region outside of specified x-range.
# I got these results from 'Math Kernel Library Version 10.3.11 Product Build 20120606 for 32-bit applications' on Windows 7.

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

'The first derivative at the left endpoint is zero.' This implies that you want the slope of the curve to be zero at the left endpoint,.i.e., the curve has as tangent a line with y'(x=the left endpoint) = 0.

A "natural" spline is one which has no bending moment applied at the ends, i.e., y'' = 0 at those points.

No..., DF_BC_1ST_LEFT_DER(==bc_type) with non-zero boundary value(==bc[0]) gives you non-zero slope of the curve.

> A "natural" spline is one which has no bending moment applied at the ends, i.e., y'' = 0 at those points.
Yes,but MKL implementation seems to be different (Pls see DF_PP_NATURAL and DF_BC_FREE_END).

Hello Shigeo,

Description of spline boundary conditions in Intel(R) MKL Manual related to derivatives of the first/second order is incorrect. If you provide DF_BC_[1ST|2ND]_[LEFT|RIGHT]_DER boundary condition to the df?editppspline1d editor, the library expects generally non-zero values of the derivatives (of course, zero values are aslo admissable). This bug in the documentation will be fixed in one of the next releases of the library.

As Mecej4 correctly pointed, natural cubic spline is one defined by free-end boundary conditions: y''(x(1)) = y''(x(n))=0.
Intel MKL implementation of cubic spline slightly extended this definition:

- if you need "classical" natural cubic spline, please specify "natural" type of the cubic spline with DF_BC_FREE_END boundary conditions

status = dfdEditPPSpline1D(task, DF_PP_CUBIC, DF_PP_NATURAL,DF_BC_FREE_END, 0, DF_NO_IC, 0, scoeff, scoeffhint)

- if you need cubic spline with other boundary conditions, please specify "natural" type of the cubic spline with required boundary conditions, e.g.:

status = dfdEditPPSpline1D(task, DF_PP_CUBIC, DF_PP_NATURAL,
DF_BC_1ST_LEFT_DER | DF_BC_1ST_RIGHT_DER , bc, DF_NO_IC, 0, scoeff, scoeffhint)

In this case you will construct a non-natural cubic spline with given boundary conditions.

Does this approach work for you or you would prefer to see clear difference in specification of natural and non-natural cubic splines?

For linear spline with periodic conditions the library expects y(x(1)) = y(x(n)). If your function meets this condition you will get the same results with or without specification of the periodic boundary conditions.
If you specify periodic boundary conditions for linear spline, and your function y does not meet the equality above, the library is expected to return relevant error code. However, this is not the case in the current version of Intel(R) MKL, and testing of periodicity conditions should be supported for linear spline in future releases of the library.

Please, let us know, if this answers your questions, or additional details are necessary.


Hi Andrey,Thank you for your detailed explanation. I thoroughly understand.

I currently have no time to recomfirm same things and might have some confusions,
but it should be worth listing what I have noticed so far.

1.The documentation says,conditions such as DF_BC_NOT_A_KNOT etc have priorities
and any conditions having less priority is ignored.
But actually,dfsEditPPSpline1D returns error instead of ignoring.

2.Hint Values for Vector-Valued Function y (yhint) for dfdNewTask1D,

3.df?interpolate1d,hint Values for the rhint Parameter(DF_MATRIX_STORAGE_ROWS or
DF_MATRIX_STORAGE_COLS) has no difference?

4.DF_BC_Q_VAL option for default quadratic spline,only one y((x0 + x1)/2) value is allowed for all ys as boundary condition,
but this is somewhat strange for Vector-Valued Function y ( Every yi meet always at one point ((x0 + x1)/2,yi((x0 + x1)/2)) ).

5.There are so many spline types such as Akima, Bessel, Hermite, natural cubic, quadratic Subbotin ...
It will be helpfull if the documentation tells us which is the most suitable type for specific computation field.

Thank you again

Hi Shigeo,

I do appreciate your questions/feedback related to Intel(R) MKL interpolation functions. Let me address your comments one be one:

1. Yes, the library sets the priorities for boundary conditions as described in the documentation.
The editor df?editppspline1d returns error when you specify boundary conditions which requires array bc, but bs is not provided. For example, in code below the editor returns error DF_ERROR_BAD_BC

bc = 0;
status = dfdEditPPSpline1D(task, DF_PP_CUBIC, DF_PP_NATURAL,
DF_BC_1ST_LEFT_DER | DF_BC_1ST_RIGHT_DER , bc, DF_NO_IC, 0, scoeff, scoeffhint);

At the same time, if you specify
as boundary conditions, on the stage of spline construction (function df?construct1d) the library will return error instead of ignoring 2nd order derivatives (as specified in the documentation). I believe that such behavior of the library in this corner case should be properly fixed.

2. When you provide a vector-valued function, the library will interpret its storage format according to yhint parameter. However, when you construct spline for this vector-valued function, spline coefficients will be always stored in the same, row-major format as specified in the description of df?editppspline1d editor. This is design decision which additional helps to address performance aspects.

3. When you interpolate using df?interpolate1d function, the inteporlation results will be packed according to value of rhint parameter as described in df?interpolate1d/df?interpolateex1d section of the manual. For vector-valued function interpolation results are packaged one-by-one for each coordinate of the function, in natural order. Interpolation results for each coordinate are packed according to value of parameter rhint, in row- or column-major format. You will not see any difference when you request to compute just one derivative of given order (say, only value or derivative of the second order). The difference is visible when you request two estimates, say value and derivative of the first order.

4. Specification of one point as boundary condition for vector valued function was design decision. We investigate opportunities to eliminate this limitation.

5.While I'm not sure the request to describe applicability of splines in different computational fields fits into Intel(R) MKL Manual, it might look like a document similar to VSL Notes describing MKL random number generators and Summary Statistics Application Notes describing algorithms for stat analysis available at We need to better understand the details behind such document.

Also, for further reference I suggest to use Intel MKL(R) docs available at

Please, let me know if I covered your comments, and feel free to share with us further feedback or questions related to splines or other domains of the library.


Hi Andrey,
Thak you for your complete answers. Because MKL DataFitting is so complecated (versatile or flexible) for me that made me confused.
But I'm getting used to it little by little now.

Leave a Comment

Please sign in to add a comment. Not a member? Join today