Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

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

$
0
0

Hello,

I'm using the MKL in the Composer 16update 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[i], cellIds[i]);

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[i] <= 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''.

Itis 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

Zone: 

Thread Topic: 

Question

Viewing all articles
Browse latest Browse all 2652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>