GithubHelp home page GithubHelp logo

Comments (7)

OlivierHnt avatar OlivierHnt commented on August 17, 2024 1

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.

Kolaru avatar Kolaru commented on August 17, 2024 1

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.

lbenet avatar lbenet commented on August 17, 2024

The setdecoration function seems a resonable addition to me! 👍

from intervalarithmetic.jl.

lbenet avatar lbenet commented on August 17, 2024

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 BareIntervals!), 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.

lbenet avatar lbenet commented on August 17, 2024

One could also return _unsafe_interval(bx, d, isguaranteed(bx))...

from intervalarithmetic.jl.

lbenet avatar lbenet commented on August 17, 2024

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.

OlivierHnt avatar OlivierHnt commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.