-
Notifications
You must be signed in to change notification settings - Fork 9
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
Divide by zero error in line search #8
Comments
This functions looks for the minimizer of a quadratic function f(x) defined over the interval [a,b] with given derivatives f'(a) and f'(b). In order to have the problem well-posed the derivatives must obey the condition f'(a)<0 and f'(b)>0. find_quadratic_minimizer is called from lines 51 and 46 ; 51 should not pose any problem since the condition is verified explicitly, and a call from 46 guarantees two different values f(a) and f(b), and therefore the derivatives must differ. It does seem that you are working beyond the limits of machine precision. It is a bad idea to have this workaround. Linesearch must fail in this case. Division by zero is supposed to be checked in lines 90-98 of linesearch.cpp, it would be a good idea to investigate. Do you get an exception? |
Yes, the code crashes with some specific input with a 1/0 error. I do think precision may be the issue and will try to move to an integer x vector. |
At line 40 in the linesearch.cpp code there is a divide by zero occurring.
I tried to code a work around with an if (ga == gb) statement, but don't know what the return value should be in that case. Suggestions?
The text was updated successfully, but these errors were encountered: