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

df?dSearchCells1D give different result between Composer 16 and 16 Update3

Guillaume_A_2
Beginner
321 Views

Hello,

I'm using the MKL in the Composer 16 update 3 release and I notice a weird behaviour of the df?dSearchCells1D routine when a sitePoint is equal to the last breakPoint.

I did a little test :

  const int NBBreakpoint = 3;
  const int NBSite = 7;

  double *breakpoints = new double[NBBreakpoint];
  double *sites = new double[NBSite];
  int *cellIds = new int[NBSite];
  int *expectedCellIds = new int[NBSite];

  // ref values 
  const double minBreakpoint = 0.0;
  const double maxBreakpoint = 2.0;
  breakpoints[0] = minBreakpoint;
  breakpoints[1] = (maxBreakpoint - minBreakpoint) * 0.5;
  breakpoints[2] = maxBreakpoint;

  // Sites values 
  sites[0] = minBreakpoint - (maxBreakpoint - minBreakpoint) * 0.25;  // before the first breakpoint
  sites[1] = minBreakpoint;                                           // first breakpoint
  sites[2] = minBreakpoint + (maxBreakpoint - minBreakpoint) * 0.25;  // between first and second breakpoints
  sites[3] = breakpoints[1];                                          // second breakpoint
  sites[4] = minBreakpoint + (maxBreakpoint - minBreakpoint) * 0.75;  // between second and last breakpoints
  sites[5] = maxBreakpoint;                                           // last breakpoint
  sites[6] = maxBreakpoint + (maxBreakpoint - minBreakpoint) * 0.25;  // after the last breakpoint

  DFTaskPtr task;
  auto status = dfdNewTask1D(&task, NBBreakpoint, breakpoints, DF_NON_UNIFORM_PARTITION, 0, nullptr, DF_MATRIX_STORAGE_ROWS);
  status = dfdSearchCells1D(task, DF_METHOD_STD, NBSite, sites, DF_NON_UNIFORM_PARTITION, nullptr, cellIds);

  for (int i = 0; i < NBSite; ++i)
    printf("site: %lf\tcellId: %d\n", sites, cellIds);

Here is my output with Composer 16:

site: -0.500000    cellId: 0
site: 0.000000    cellId: 1
site: 0.500000    cellId: 1
site: 1.000000    cellId: 2
site: 1.500000    cellId: 2
site: 2.000000    cellId: 3
site: 2.500000    cellId: 3

So, the behaviour was clear and consistent:

  // dfdSearchCells1D returns:
  // 0    if site is less than first breakpoint
  // i+1  if breakpoint <= site < breakpoint[i+1]

But here is my output with Composer 16 update 3:

site: -0.500000    cellId: 0
site: 0.000000    cellId: 1
site: 0.500000    cellId: 1
site: 1.000000    cellId: 2
site: 1.500000    cellId: 2
site: 2.000000    cellId: 2
site: 2.500000    cellId: 3

I am expecting to get 3 as result for ''site = 2.0 = maxBreakpoint''.

It is annoying that there is not anymore consistency. Now, in my case, I have to check manually if my site is or not on the last breakpoint.

Is that a bug or the expected behaviour ? (the documentation is really really poor about this routine....)

Thanks in advance for your answer,

Guix

0 Kudos
3 Replies
Gennady_F_Intel
Moderator
321 Views

Hi Guillaume! 

Yes, this is expected result. We changed the behavior of this function based on user's feedback. With regard to documentation - You are right. We have to add some Notification about this topic. It will be done asap. Thanks for the feedback.

-Gennady 

0 Kudos
Guillaume_A_2
Beginner
321 Views

Thanks for your reply Gennady.

I cannot figure out how others users deal efficiently that kind of result... how can they know if their sitePoints are on the last breakPoint or on the penultimate or between those two points ?

It is illogical: The routine was typically rightContinuous, and now it is still rightContinuous except for last breakPoint.

A parameter to set right or left continuous behavior could be a good thing.

Guix

0 Kudos
Andrey_N_Intel
Employee
321 Views

Hi Guillaume, we analyze your request to understand options to address it. Thanks, Andrey

0 Kudos
Reply