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

Quadratic spline curve construction fails

Andrew_Smith
Valued Contributor I
461 Views

When I try to create a quadratic spline curve, the spline type DF_PP_DEFAULT should be accepted according to the reference help, but is not. It gives error code -1011 (DF_ERROR_BAD_SPLINE_TYPE).

It accepts spline type DF_PP_SUBBOTIN but then the boundary condition type DF_NO_BC should be accepted according to the reference help, but gives error code -1014 (DF_ERROR_BAD_BC_TYPE).

It kind of accepts boundary condition DF_BC_FREE_END but then gives error code -1012 (DF_ERROR_BAD_IC_TYPE). Why is this happening please?

The errors only get raised after the dfdconstruct1d is called and not earlier when calling dfdeditppspline1d where the settings are set. Its odd but not an issue.

Here is test code for the -1012 error:

program Console2
   use MKL_DF
   implicit none
   real(8), allocatable :: scoeff(:)
   real(8), parameter :: x(3) = [0.0D0, 8.295D-3, 1.659D-2]
   real(8), parameter :: y(3) = [6.0D-006, 0.0D0, 6.0D-006]
   integer errorCode, nx
   type(DF_TASK) :: task
   real(8), parameter :: boundary_values(2) = [0D0, 0D0]

   allocate(scoeff(DF_PP_QUADRATIC*(size(x)-1)))
   errorCode = 0
   nx = size(x)
   errorCode = dfdnewtask1d(task, nx, x, DF_NO_HINT, 1, y, DF_NO_HINT)
   if (errorCode /= 0) stop
   errorCode = dfdeditppspline1d(task, DF_PP_QUADRATIC, DF_PP_SUBBOTIN, DF_BC_FREE_END, boundary_values, scoeff = scoeff)
   if (errorCode /= 0) stop
   errorCode = dfdconstruct1d(task, DF_PP_SPLINE, DF_METHOD_STD)
   print *, errorCode
   pause

end program Console2

 Using oneAPI MKL 2024.0 on windows

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
421 Views

It looks like a problem, thanks Andrew. 

We will investigate this case.

--Gennady

View solution in original post

2 Replies
Gennady_F_Intel
Moderator
422 Views

It looks like a problem, thanks Andrew. 

We will investigate this case.

--Gennady

Gennady_F_Intel
Moderator
166 Views

Andrew,


1. Default quadratic splines support only DF_BC_Q_VAL as a boundary condition. That's why it reports an error. It needs to set boundary condition explicitly. Following example will work:

errorCode = dfdeditppspline1d(task, DF_PP_QUADRATIC, DF_PP_DEFAULT, DF_BC_Q_VAL, (/1.0D0/), scoeff = scoeff)

2. Only following boundary conditions are supported for Subbotin: free end and combinations of 1st and 2nd derivatives (left, right). DF_NO_BC is not supported

 

3. Only DF_IC_Q_KNOT internal condition is supported for Subbotin. So, it should be set explicitly in the code. Following example will work:

 

real(8), parameter :: internal_values(4) = [0D0, (0.0D0 + 8.295D-3) / 2D0, (8.295D-3 + 1.659D-2) / 2D0, 1.659D-2]

...

errorCode = dfdeditppspline1d(task, DF_PP_QUADRATIC, DF_PP_SUBBOTIN, IOR(DF_BC_1ST_LEFT_DER, DF_BC_1ST_RIGHT_DER), (/1.0D0,-1.0D0/), DF_IC_Q_KNOT, internal_values, scoeff = scoeff)


--Gennady


0 Kudos
Reply