-
Notifications
You must be signed in to change notification settings - Fork 17
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
Improve product of TaylorModelN
s
#31
Conversation
I'll try to improve the bounds of the result; one test needed to be corrected. |
This should fix #29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hard to keep track of the orders of everything. Can't we just fix the order of everybody?
src/arithmetic.jl
Outdated
|
||
# We evaluate each term of the product of coefficients at `aux` | ||
Δnegl = zero(Δ) | ||
for order = order_max+1:order_prod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this start at order_max
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am correcting that, it should be orderTS
. The idea, as I say above, is to compute the resulting polynomial up to orderTS
, and from there bound whatever is not included in the polynomial part.
It may be simpler, indeed, but the user is not forced to do that. |
Just pushed a new commit which improves further (but not as significantly as before) the already improved allocations and timings. |
When used in the context of validated integration, this PR leads to ~ 3x regression ... |
My idea was that we could just define arithmetic etc. operations only when the two Taylor models have the same order (which can be encoded as a type parameter) to simplify the code. |
orderini = order - orderTS | ||
for inda = orderini:order_a | ||
indb = order - inda | ||
# Δnegl += evaluate(apol[inda], aux) * evaluate(bpol[indb], aux) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could try evaluating all of these bounds once before the loop (and storing them in new arrays), and then just indexing into the arrays inside the for
loops. This should be much faster.
What I had done previously was store these bounds in the TaylorModel
object itself when it is created (so that they are calculated exactly once in the history of the object).
I've been playing with the last two commits together with #18 and the van der Pol and Lotka-Volterra systems. As I noted above, there is a marked speed-down in comparison with what we have in #18 alone.
I guess that the problem is related with the big amount of evaluations required, which happen to be related with |
It's the fastpowers branch of IntervalArithmetic.jl. There is no question that we should be using that branch! It should be around a factor of 4 speedup (at least)? |
Note that if we use normalised polynomials then it should be possible to do evaluations without using powers at all! |
Thanks! I'll play using that branch and report things back here.
I agree; the question is if that normalization should be |
Another possibility, which is the one I'm pursuing now, is to work with |
Closing; see #81 |
This improves the product of two
TaylorModelN
objects. It avoids duplicating the order forTaylorN
, which avoids some allocations.