BUG: Fix incorrect initialization in bspline kernel#9486
Conversation
|
@seberg I think it is not necessary to initialize
|
This comment was marked as outdated.
This comment was marked as outdated.
This fixes the use of uninitialized memory in the bspline kernel `d_boor` kernel. Testing is unfortunately not really possible directly, this leads to occasionally test failures. I did test it locally, by replacing all ``empty`` calls with either filling with NaN or the minimum integer, though. Closes cupygh-7240
|
@asi1024 OK, I think I found the actual issue, I guess... This one looks like a clear typo and makes a lot more sense. I won't claim to have understood why this issue leads to the above observations or the algorithm, but it's clear that |
|
We should wait a bit for @ev-br, we have been chatting a bit and he is looking at the SciPy code. SciPy has the same code although it (recently) started to zero the input. But... let's see maybe @ev-br finds something more here. It still looks like a typo to me, but it sounds like there may be a bit more complexity here. |
|
OK, I think we agreed to (and Evgeni found a bit more to back it up), that deBoors formula has a funny "use zero when it would be divide by zero" which is the reason for the path, so that the fix is right. Evgeni figures the reason why this is that it is practically impossible to hit this path to begin with: The test is very strange. |
|
/test mini |
|
To summarize, I indeed believe this is the right fix. A typo (mu<->n) led to using uninitialized memory in some cases. |
|
@seberg Many thanks for looking into the flaky failure! LGTM! |
BUG: Fix incorrect initialization in bspline kernel
…24106) Upstream the CuPy fix, cupy/cupy#9486 Discussed at cupy/cupy#7240 (comment)
This fixes the use of uninitialized memory in the bspline kernel
d_boorkernel.Testing is unfortunately not really possible directly, this leads to occasionally test failures.
I did test it locally, by replacing all
emptycalls with either filling with NaN or the minimum integer, though.Closes gh-7240
I am not really worried about it being wrong (the original code always uses uninitialized data here), but maybe @andfoy you can have a brief look? In some paths it seems it only matters that this value isn't NaN or similar (i.e. probably it leads to
value - valuewhich is mathematically be zero but isn't for NaN/inf).But I think the design-matrix tests wanted one here?