-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault with 0-degree polynomials and autodiff #47
Comments
Hi @isutoris I've never actually tried this before. I don't think I'll have time to personally debug/resolve this issue. If I were going to attempt it I would first move the |
Thanks for the pointer. After looking at those lines, it does seem like they are always trying to fill first two columns of the One possible fix would be to simply handle the case n=1 separately beforehand:
which seems to fix the segfault in my case. If you think this is sufficient, I can try to submit a PR later (once I figure how). BTW, similar issue appears to be present also in smol_util.jl, although I haven't yet looked at that more closely. |
Ahh good catch. Yes, when you have the time will you please open a PR. Fixing smol_util.jl at the same time would be an added bonus ;) Thanks! |
I'm not sure if this is a problem with BasisMatrices or somewhere deeper in Julia, so apologies if this is not the right place. Anyway, on my computer (Julia 0.6.0) and also on JuliaBox (0.6.2), the following consistently segfaults:
Using 0-th degree polynomials is kind of a hack, but the original idea was to use 0-degree / 1-coefficient polynomials as basis functions in some dimensions to impose the approximated function to be constant in those dimensions. This works when evaluated at standard float inputs for x, but apparently not when x is array of ForwardDiff duals (although interestingly it did work in two dimensions, only at three I came across the issue).
I'm attaching segfault output, according to which the crash happened somewhere in base linear algebra routines. However it's not consistent - for some other inputs the crash happened somewhere inside garbage collector instead, so who knows...
The text was updated successfully, but these errors were encountered: