- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I run a likelihood maximization programme using Nelder_Mead algorithm The programme aborted after 42 iterations and poped up this error message" runtime error m6201 sqrt domain error"It usually the case I tried to take "dsqrt" of a negative number if I run into an error message like that; but I am sure it is not this time. It is something squared plus 1 so there is no way it is negative. It must be bigger than 1.
I tried to run exactly the same code on my laptop. It worked. After repeated the same likelihood function value for several iterations, it moved on rather than aborted.
Do you know why? It take weeks for my algorithm to converge. I would really prefer to run it on a desktop in computer lab rather than on my laptop. Also it is killing me when I know the number I am taking dsqrt of is definitely positive. (I bet my life on it)
I tried to run exactly the same code on my laptop. It worked. After repeated the same likelihood function value for several iterations, it moved on rather than aborted.
Do you know why? It take weeks for my algorithm to converge. I would really prefer to run it on a desktop in computer lab rather than on my laptop. Also it is killing me when I know the number I am taking dsqrt of is definitely positive. (I bet my life on it)
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We need more information. Are you using complex variables anywhere?
Is the '1' you refer to stored as a variable or is it an explicit constant like '1.0d+00'?
We need to see the code in all places leading up to where you explicitly call the SQRT function.
Plus, the SQRT function may be being used internally by another function, so there may be no alternative but to run in debug mode and see exactly where it falls over.
Is the '1' you refer to stored as a variable or is it an explicit constant like '1.0d+00'?
We need to see the code in all places leading up to where you explicitly call the SQRT function.
Plus, the SQRT function may be being used internally by another function, so there may be no alternative but to run in debug mode and see exactly where it falls over.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not negative OK, but have you considered the possibility that it's Inf or NaN? "Something squared plus 1" implies that the intermediate result might easily overflow.
In any case, compile your code with /fpe:3 (raise floating-point exceptions) and run it through the debugger.
Since the code seems to work on the laptop, you might easily have uninitialized variable somewhere. Try to build ti with /check:all.
In any case, compile your code with /fpe:3 (raise floating-point exceptions) and run it through the debugger.
Since the code seems to work on the laptop, you might easily have uninitialized variable somewhere. Try to build ti with /check:all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Jugoslav Dujic
It's not negative OK, but have you considered the possibility that it's Inf or NaN? "Something squared plus 1" implies that the intermediate result might easily overflow.
In any case, compile your code with /fpe:3 (raise floating-point exceptions) and run it through the debugger.
Since the code seems to work on the laptop, you might easily have uninitialized variable somewhere. Try to build ti with /check:all.
In any case, compile your code with /fpe:3 (raise floating-point exceptions) and run it through the debugger.
Since the code seems to work on the laptop, you might easily have uninitialized variable somewhere. Try to build ti with /check:all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, which compiler and version are you using?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page