Pls run the program bellow,and confirm the difference between NY==1 and NY==2 case.
DFTaskPtr task;
// int NY = 2;
int NY = 1;
double x[] = {1,2, 3, 4, 5};
double y[] = {0,2,-1,-0.5,0,-1,1,-2,-1.5,-1};
int NX = sizeof(x)/sizeof(x[0]);
int order = 1;
int dorder[] = { 0,0 };
int ndorder = sizeof(dorder)/sizeof(dorder[0]);
double coef[20];
double xv = 0.0;
double yv[2];
int status;
status = dfdNewTask1D( &task,NX,x, DF_NON_UNIFORM_PARTITION, NY, y, DF_MATRIX_STORAGE_ROWS );
status = dfdEditPPSpline1D(task, DF_PP_LINEAR, DF_PP_DEFAULT, DF_NO_BC , NULL, DF_NO_IC, NULL, coef, DF_NO_HINT);
status = dfdConstruct1D( task, DF_PP_SPLINE, DF_METHOD_STD );
for(int i=1;i<=NX;++i)
{
xv = i;
status = dfdInterpolate1D( task, DF_INTERP, DF_METHOD_PP, 1, &xv, DF_NON_UNIFORM_PARTITION, ndorder, dorder, NULL, yv, DF_MATRIX_STORAGE_ROWS, NULL );
if(NY==2) printf("status = %d x=%g y=[%g,%g]\n",status,xv,yv[0],yv[1]);
else printf("status = %d x=%g y=[%g]\n",status,xv,yv[0]);
}
===== the results when NY=1 follow
status = 0 x=1 y=[0]
status = 0 x=2 y=[-1.5] <= why not 2.0 ?
status = 0 x=3 y=[-1]
status = 0 x=4 y=[-0.5]
status = 0 x=5 y=[0]
===== the results when NY=2 follow
status = 0 x=1 y=[0,-1]
status = 0 x=2 y=[2,1] <= Yes OK!
status = 0 x=3 y=[-1,-2]
status = 0 x=4 y=[-0.5,-1.5]
status = 0 x=5 y=[0,-1]
------------------------------------------------
I got the results under MKL V11.1.1 Product Build 20131010 for 32-bit application on Windows-7.
链接已复制
Hello Shigeo Kobayashi,
The test case you have provided reproduces a bug in MKL 11.1.1. dfdinterpolate1D function has an issue with processing small tasks when ny = 1 and nsite = 1, like in your example.
This issue was also revealed by our internal testing and the fix is planned for the next MKL 11.1 update. Currently you could use a workaround: Please use nsite = 2 and pass array of 2 elements as an array of interpolation sites to obtain correct results.