Comments (7)
If I recall correctly, @Kolaru also complained about this default trv
decoration for IntervalRootFinding.jl.
But if we change it, how do we preserve compliance with the standard? In particular, with the ITF1788 test suite? Cf. https://github.com/JuliaIntervals/IntervalArithmetic.jl/blob/7c46049a7455305991647115328942f0d2331239/test/ITF1788_tests/libieeep1788_set.jl#L15C1-L27C4
The setDec
function may be exactly what can solve this issue. Currently one can have a similar behaviour to setDec
by using the internal unsafe constructor _unsafe_interval
; so we could have
setdecoration(x::Interval, d::Decoration) = _unsafe_interval(bareinterval(x), d, isguaranteed(x))
from intervalarithmetic.jl.
Well yes this trv
is a pain.
As I understand it, it means that this interval does not result from the the interval extension of a well behaved function. Which is fair in that case.
I think we could have the more sensible behavior as intersect_interval
and have another one (like intersect_interval_trv
or intersect_interval_burn_the_standard
) for the required behavior. We would be compliant, and still propose our favorite behavior.
from intervalarithmetic.jl.
The setdecoration
function seems a resonable addition to me! 👍
from intervalarithmetic.jl.
I fully agree with @Kolaru.
My proposal is having an internal helper funcion at least, say _intersect_bareinterval(bx::BareInterval, by::BareInterval)
(only acting on BareInterval
s!), where bx
is the BareInterval
part of the argument x
passed to the function (think we are computing log(x)
), and by
corresponds to the (bareinterval) domain of the function. That function should compute the min decorations attributed to bx
and by
and check if bx
is inside the domain by
, returning the bareinterval intersection and the decoration:
function _intersect_bareinterval_nontrv(bx::BareInterval, by::BareInterval)
bx = intersect_interval(bx, by)
d = min(decoration(bx), decoration(by))
d = min(d, felse(isinterior(bx, by), d, trv))
return bx, d
end
This could allow us to avoid some code which is repeated (changing perhaps the domain) and use it elsewhere without trivializing the results of intersect_interval
.
from intervalarithmetic.jl.
One could also return _unsafe_interval(bx, d, isguaranteed(bx))
...
from intervalarithmetic.jl.
I think the following is more useful
function _intersect_bareinterval_nontrv(bx::BareInterval, by::BareInterval)
bx = intersect_interval(bx, by)
d = decoration(bx)
d = min(d, felse(isinterior(bx, by), d, trv))
return _unsafe_interval(bx, d, isguaranteed(bx))
end
from intervalarithmetic.jl.
Do you mean
function _intersect_bareinterval_nontrv(x::Interval, domain::BareInterval)
bx = bareinterval(x)
r = intersect_interval(bx, domain)
# decoration should not inherit the domain decoration (could be [0, Inf))
# if `!issubset(bx, domain)`, then `r` is empty and `decoration(r) == trv`
d = min(decoration(x), decoration(r))
return _unsafe_interval(r, d, isguaranteed(x))
end
?
I do not think we will be able to refactor code substantially with such an internal function (intersection with the domain and the determination of the decoration is decoupled to avoid intersecting twice).
EDIT: in fact there is an other issue with _intersect_bareinterval_nontrv
as sometimes the bounds of the domain (given as a bare interval) are singular points. In this case (e.g. for log
), we do need the check isinterior
as you did. For other cases (e.g. sqrt
), we need the check issubset
(see also the code snippet in this comment).
I think we could have the more sensible behavior as intersect_interval and have another one (like intersect_interval_trv or intersect_interval_burn_the_standard) for the required behavior. We would be compliant, and still propose our favorite behavior.
While I am not entirely opposed to this proposal, I find it a bit confusing to have two intersect functions.
I mean intersect_interval_burn_the_standard(x, y)
would be the same as setdecoration(intersect_interval(x, y), min(decoration(x), decoration(y)))
which to me looks nicer (and is also more general).
from intervalarithmetic.jl.
Related Issues (20)
- ForwardDiff with min, max, and clamp HOT 3
- `string(x::Interval)` is not working correctly HOT 1
- Unclear error for malformed interval
- Can't multiply a `BareInterval` by a scalar HOT 5
- Document `in` behaviour HOT 2
- Define ` ∩` and `∪` for `BareInterval` HOT 6
- Define and export Heaviside function HOT 2
- No mechanism to define functions restricted to a domain HOT 2
- Piecewise functions HOT 5
- Add `\infty` symbol to Symbols module HOT 1
- `zero(emptyinterval())` should be empty HOT 1
- Expose domain of functions HOT 5
- `hull` with `NaI` gives non-NaI HOT 1
- Reinstate fast rounding with `prevfloat` and `nextfloat` HOT 2
- Give a hand to downstream packages to update to v0.22
- Define `x // 3` for an interval `x` HOT 2
- Document the decoration and flag system HOT 3
- Is `cbrt` correctly rounded? HOT 2
- Document `PowerMode` HOT 11
- Document `isapprox` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intervalarithmetic.jl.