Skip to content

Commit

Permalink
#1978 - Faster conversion from 1D hyperrectangle to interval (#2456)
Browse files Browse the repository at this point in the history
* faster conversion from 1D hyperrectangle to interval

* Update src/convert.jl

Co-authored-by: Christian Schilling <[email protected]>

Co-authored-by: Christian Schilling <[email protected]>
  • Loading branch information
mforets and schillic authored Dec 22, 2020
1 parent 5b0ff86 commit bda5c7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/convert.jl
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ Interval{Float64,IntervalArithmetic.Interval{Float64}}([0, 1])
```
"""
function convert(::Type{Interval}, H::AbstractHyperrectangle)
@assert dim(H) == 1 "cannot convert a $(dim(H))-dimensional $(typeof(H)) to `Interval`"
return Interval(low(H)[1], high(H)[1])
@assert dim(H) == 1 "can only convert a one-dimensional $(typeof(H)) to `Interval`"
return Interval(low(H, 1), high(H, 1))
end

"""
Expand Down

0 comments on commit bda5c7c

Please sign in to comment.