-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
std_dev calculation stuck in newer versions #105
Comments
Before version 3.0, each intermediate result stores its exact dependence on the relevant variables (eager calculation). Starting with version 3.0, this dependence is indeed probably calculated only when the uncertainty is needed (this is to be confirmed; presumably, #30 contains most of the relevant information, but finding it is not so obvious). This brought a massive (think like 5,000 x) for a calculation like Doing something like a cumulative sum of independent variables is still very expensive: it runs in quadratic time, because each term as 1, 2, 3,… etc. variables and the current algorithm (very likely) keeps a separate structure in memory for each term. Could your case be similar to this? |
There is more information on the optimizations introduced in version 3.0 in issue #53. The general key point to keep in mind about any version is that any intermediate result that is printed prompts a calculation that requires the evaluation of derivatives with respect to all its variables. Thus, printing each term of a cumulative sum requires a quadratic calculation time, which is slow. Could this be the problem in your case? |
Hi |
OK. What do you mean exactly by "the code calculates first derivatives": that you wrote custom code for this? I'm asking this because |
Jinx! |
If I understand correctly, the total run time (calculation + display) is essentially the same for both version 3 and version 2 of |
I am closing this, as it looks like there is no problem (same total run time with versions 2 and 3). If this is not the case, please reopen the issue. |
Hi
I've been trying to use uncertainties in my module. I've tried to create the smallest code I could create to regenerate the issue I've been seeing. Please find it attached.
The code tries to create a class ucomplex to hold complex numbers as tuples made out of ufloat numbers.
Then a recursive calculation is done to calculate some parameters and the output is displayed. The thing is that the calculations run really fast in the latest version (3.1.2) of uncertainties but the final display step takes a long time. You can see that with just nol=5, which increases the recursive steps, the time taken becomes really long. Here is the output:
While in version 2.4.8.1, this calculation is slower but the display is lightning fast even for nol=57 which is my required value to use. Output:
But this still takes overall much less time than the nol=5 case for 3.1.2.
My guesses are:
uncErrorRegeneration.zip
the calculations and hence is slower but the display is instant.
3) Somehow, there is some part in calculation with ucomplex which is taken long time for uncertainties to get derivative of for calculation of std_dev.
I would like to know if there is some feature which can enable std_dev calculation on the run as being done in 2.4.8.1 or suggest some changes in my definition of ucomplex which might be causing this problem. I would like to make my module compatible with the latest version of uncertainties.
The text was updated successfully, but these errors were encountered: