2

Does anyone knows why it is returning NAN values when I use ArrayFire af::Max on 2D array? This is ok when I am doing it on a 1D array, but, when I wanted to do it on a 2D array, it doesn't work, but, the documentation says NAN values are ignored. So, did I do something wrong?

If I drop the first row, it works. But, if I have NAN all over the places, I would be screwed, so, I better do this correctly.

  af::array maxSlopeIndexes;
  af::array maxSlopes;
  af::max(maxSlopes, maxSlopeIndexes, slopes, 0);
  af_print(maxSlopeIndexes);
  af_print(maxSlopes);

slopes
[6 3 1 1]
 -nan(ind)  -nan(ind)  -nan(ind)
   -1.0000    -2.0000    -3.0000
    0.5000     0.0000    -0.5000
    3.0000     2.6667     2.3333
    0.7500     0.5000     0.2500
    0.8000     0.8000     0.8000

maxSlopeIndexes
[1 3 1 1]
         0          0          0
maxSlopes
[1 3 1 1]
 -nan(ind)  -nan(ind)  -nan(ind)

Thank you

BoBoDev
  • 847
  • 1
  • 8
  • 17
  • How do you generate the `slopes`array? can you expand your question with data to make it reproducible for us? – Ralf Stubner Apr 23 '18 at 10:50
  • Possibly related: https://github.com/arrayfire/arrayfire/issues/2130 – Ralf Stubner Apr 23 '18 at 11:05
  • @RalfStubner The slopes are simply generated with Y Diff / X Diif. Just that my first slope is divided by zero. The link you provided appears to be the same problem. Both of us are trying to get the index and it is not working. Thanks – BoBoDev Apr 24 '18 at 01:09

0 Answers0