-
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
Inverse Laplace may not be very effectively implemented #110
Comments
ps: one of the things to figure out is the precision of the Weeks algorithm for our application. It might be that Talbot remains a better option if the numbers are better. |
If Weeks is faster, without loss of accuracy, then it's fine with me. But accuracy will need to be evaluated carefully. There is another issue related to InverseLaplace.jl also, maybe there is a way to solve both at the same time. Note I probably don't agree with the solution I proposed there some time ago, I haven't thought about it recently enough to have an informed opinion: There are benefits to using BigFloat in some of the package's algorithms but I could not figure out how to include that in Rheos in a performant way at that time, and did not prioritise working on it. I'm sure there is something we can do if we want to boost accuracy there: |
Thanks for linking to #32 I think using BigFloat shouldn't be a problem for most things, except NLopt that uses Float64. That is quite a limitation at the moment. |
Agreed, definitely worth exploring to find an optimum solution here! And I can see the benefits that
My only thought would be to test the various moduli for which we know both laplace and exact time-domain forms, with some representative parameters, dt and number of samples. But I have not seen any nice documents on truly rigorous testing of complex numerical algorithms. |
I had a look at the inverse Laplace methods we used to see if there is scope for improvement and better integration with expressions. I believe that the Weeks algorithm may be better suited to work on arrays:
https://jlapeyre.github.io/InverseLaplace.jl/latest/index.html#InverseLaplace.Weeks
Here is a bit of benchmark code to compare different approaches (Talbot, Talbot for arrays, Weeks, Weeks in function wrappers, and the current implementation in Rheos based on Talbot in function wrappers). We could go 5-10 times faster than we do now on arrays with 1000 elements, having already increased the precision of the Weeks algorithm compared to the default. As soon as we have 50+ elements, Weeks takes the lead. Weeks is also very convenient to integrate with the function wrappers when an expression is available. We only need to supply the expression of the Laplace transform to the constructor. The constructor would detect that the variable used is
:s
and not:t
and package it accordingly, as done below. We could continue to use Talbot for single scalar values with parameters as it is the most effective one in this case (6 times faster than Weeks for a single evaluation).Output:
The text was updated successfully, but these errors were encountered: