Hyperrectangle

LazySets.HyperrectangleModule.HyperrectangleType
Hyperrectangle{N, VNC<:AbstractVector{N}, VNR<:AbstractVector{N}
              } <: AbstractHyperrectangle{N}

Type that represents a hyperrectangle.

A hyperrectangle is the Cartesian product of one-dimensional intervals.

Fields

  • center – center of the hyperrectangle as a real vector
  • radius – radius of the hyperrectangle as a real vector, i.e., half of its width along each coordinate direction

Examples

The Hyperrectangle type stores a vector representing the center and another vector representing the radius. The default constructor Hyperrectangle(c, r) receives the center and radius, in that order. For instance,

julia> c = [-1.0, 1.0];

julia> r = [2.0, 1.0];

julia> H = Hyperrectangle(c, r)
Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}([-1.0, 1.0], [2.0, 1.0])

The above instance represents the hyperrectangle with the following vertices:

julia> vertices_list(H)
4-element Vector{Vector{Float64}}:
 [1.0, 2.0]
 [-3.0, 2.0]
 [1.0, 0.0]
 [-3.0, 0.0]

The getter functions for the center and the radius are center and radius_hyperrectangle (since radius corresponds to the radius of the enclosing ball of minimal volume):

julia> center(H)
2-element Vector{Float64}:
 -1.0
  1.0

julia> radius_hyperrectangle(H)
2-element Vector{Float64}:
 2.0
 1.0

There is also a constructor from lower and upper bounds with keyword arguments high and low. The following construction results in the same hyperrectangle as in the previous paragraph:

julia> l = [-3.0, 0.0];

julia> h = [1.0, 2.0];

julia> Hyperrectangle(low=l, high=h)
Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}([-1.0, 1.0], [2.0, 1.0])

By default, the constructor checks that that radius of the hyperrectangle is nonnegative. To suppress this check, use the check_bounds optional flag in the constructor. Note that if check_bounds is set to false, the behavior of a set with contradictory bounds is undefined.

source

Conversion

Base.convertMethod
convert(::Type{Hyperrectangle}, H::AbstractHyperrectangle)

Convert a hyperrectangular set to a hyperrectangle.

Input

  • Hyperrectangle – hyperrectangle target type
  • H – hyperrectangular set

Output

A hyperrectangle.

Examples

julia> convert(Hyperrectangle, Interval(0.0, 1.0))
Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}([0.5], [0.5])
source
Base.convertMethod
convert(::Type{Hyperrectangle}, IB::IntervalArithmetic.IntervalBox)

Convert an IntervalBox from IntervalArithmetic to a hyperrectangular set.

Input

  • Hyperrectangle – target type
  • IB – interval box

Output

A Hyperrectangle.

Notes

IntervalArithmetic.IntervalBox uses static vectors to store each component interval; hence the resulting Hyperrectangle has its center and radius represented as a static vector (SArray).

source
Base.convertMethod
convert(::Type{IntervalArithmetic.IntervalBox}, H::AbstractHyperrectangle)

Convert a hyperrectangular set to an IntervalBox from IntervalArithmetic.

Input

  • IntervalBox – target type
  • H – hyperrectangular set

Output

An IntervalBox.

source

Operations

LazySets.API.centerMethod
center(H::Hyperrectangle)

Return the center of a hyperrectangle.

Input

  • H – hyperrectangle

Output

The center of the hyperrectangle.

source
LazySets.radius_hyperrectangleMethod
radius_hyperrectangle(H::Hyperrectangle)

Return the box radius of a hyperrectangle in every dimension.

Input

  • H – hyperrectangle

Output

The box radius of the hyperrectangle.

source
LazySets.radius_hyperrectangleMethod
radius_hyperrectangle(H::Hyperrectangle, i::Int)

Return the box radius of a hyperrectangle in a given dimension.

Input

  • H – hyperrectangle
  • i – dimension of interest

Output

The box radius in the given dimension.

source
Base.randMethod
rand(::Type{Hyperrectangle}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
     [rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing)

Create a random hyperrectangle.

Input

  • Hyperrectangle – type for dispatch
  • N – (optional, default: Float64) numeric type
  • dim – (optional, default: 2) dimension
  • rng – (optional, default: GLOBAL_RNG) random number generator
  • seed – (optional, default: nothing) seed for reseeding

Output

A random hyperrectangle.

Algorithm

All numbers are normally distributed with mean 0 and standard deviation 1. Additionally, the radius is nonnegative.

source
SparseArrays.permuteMethod
permute(H::Hyperrectangle, p::AbstractVector{Int})

Permute the dimensions according to a permutation vector.

Input

  • H – hyperrectangle
  • p – permutation vector

Output

A permuted hyperrectangle.

source
LazySets.API.translateMethod
translate(H::Hyperrectangle, v::AbstractVector; [share]::Bool=false)

Translate (i.e., shift) a hyperrectangle by a given vector.

Input

  • H – hyperrectangle
  • v – translation vector
  • share – (optional, default: false) flag for sharing unmodified parts of the original set representation

Output

A translated hyperrectangle.

Notes

The radius vector is shared with the original hyperrectangle if share == true.

Algorithm

We add the vector to the center of the hyperrectangle.

source

Inherited from LazySet:

Inherited from AbstractPolytope:

Inherited from AbstractCentrallySymmetricPolytope:

Inherited from AbstractZonotope:

Inherited from AbstractHyperrectangle: