-
Notifications
You must be signed in to change notification settings - Fork 71
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
Use FastRounding for speed #25
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
==========================================
- Coverage 92.29% 91.64% -0.66%
==========================================
Files 21 21
Lines 935 945 +10
==========================================
+ Hits 863 866 +3
- Misses 72 79 +7
Continue to review full report at Codecov.
|
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.
Thanks! This is really nice. I suggest only to include docstrings, explain the restrictions of :errorfree
and rename the rounding modes.
src/intervals/arithmetic.jl
Outdated
|
||
mid{T}(a::Interval{Rational{T}}) = (1//2) * (a.lo + a.hi) | ||
|
||
function simple_mid(a::Interval) |
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.
Do we really need simple_mid
as a new function? I think its sole use is inside that method for mid
.
In any case, it is now good timing to add docstrings and tests.
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 think you're right that we no longer need simple_mid
.
src/intervals/rounding.jl
Outdated
@@ -9,6 +9,7 @@ interval rounding types, e.g. | |||
+(IntervalRounding{:none}, a, b, RoundDown) | |||
|
|||
The current allowed rounding types are | |||
- :errorfree # use errorfree arithmetic via FastRounding.jl |
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 suggest the following changes for naming the rounding modes:
:errorfree
should be named:fast
-:fast
should be named:wider
(or:wide
?)
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 should also be mentioned somewhere (the docstrings and perhaps a warning too) that :errorfree
works only with Float64
and Float32
.
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 shall still refer to :errorfree
instead of (the new) :fast
to avoid confusions.
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.
Agree with :fast
and :wide
, thanks for the suggestions.
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.
Following the standard, how about :errorfree
-> :fast
; :fast
-> :accurate
; :correct
-> :tight
?
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.
The problem is that this implies that :fast
is not :tight
, which is incorrect. (Errorfree arithmetic does give tight bounds.)
src/intervals/rounding.jl
Outdated
@@ -157,23 +199,31 @@ doc""" | |||
setrounding(Interval, rounding_type::Symbol) | |||
|
|||
Set the rounding type used for all interval calculations on Julia v0.6 and above. | |||
Valid `rounding_type`s are `:correct`, `:fast` and `:none`. | |||
Valid `rounding_type`s are `:correct`, `:fast` and `:none`, `:errorfree`. |
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 think this should read as "Valid rounding_type
s are :correct
, :fast
, :none
, and :errorfree
".
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.
Good point.
I forgot to say that this should probably be rebased against current master; the tests related to |
I just read in the standard (cf page 9, definition of tightness) about what we are discussing as rounding modes. They use the nomenclature "tightest", "accurate" and "valid", which correspond respectively to |
05b5e71
to
0228710
Compare
What is faster, I actually thought that the bounds provided by I suggest to have the docstring in decreasing order of tightness. |
What was |
So maybe we can replace |
Maybe you are right; give me a bit of time, since I thought i had some counterexample. |
I just run all ITF1788 suite tests and they pass with :errorfree / :fast. So, I agree: it should be renamed as Sorry for being so skeptic... |
I was quite sceptical actually that this would ever be possible. But thanks to @JeffreySarnoff and some hard work fixing difficult corner cases, it seems that it is finally finished! |
So far, I have |
! |
That's ok with me! Once travis shows the green lights, I'll merge this. |
2 similar comments
Everything is passing! |
This is really nice! Merging... |
Thanks! |
Use
FastRounding.jl
as a drop-in replacement for changing the rounding mode. This gives a 3-4x speed-up for basic arithmetic operations.