Hyperrectangle
LazySets.HyperrectangleModule.Hyperrectangle
— TypeHyperrectangle{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 vectorradius
– 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.
Conversion
convert(::Type{Hyperrectangle}, ::AbstractHyperrectangle)
convert(::Type{Hyperrectangle}, ::IA.IntervalBox)
convert(::Type{IA.IntervalBox}, ::AbstractHyperrectangle)
Operations
LazySets.radius_hyperrectangle
— Methodradius_hyperrectangle(H::Hyperrectangle)
Return the box radius of a hyperrectangle in every dimension.
Input
H
– hyperrectangle
Output
The box radius of the hyperrectangle.
LazySets.radius_hyperrectangle
— Methodradius_hyperrectangle(H::Hyperrectangle, i::Int)
Return the box radius of a hyperrectangle in a given dimension.
Input
H
– hyperrectanglei
– dimension of interest
Output
The box radius in the given dimension.
Base.rand
— Methodrand(T::Type{<:LazySet}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing
)
Create a random set of the given set type.
Input
T
– set typeN
– (optional, default:Float64
) numeric typedim
– (optional, default: 2) dimensionrng
– (optional, default:GLOBAL_RNG
) random number generatorseed
– (optional, default:nothing
) seed for reseeding
Output
A random set of the given set type.
Base.rand
— MethodExtended help
rand(::Type{Hyperrectangle}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing)
Algorithm
All numbers are normally distributed with mean 0 and standard deviation 1. Additionally, the radius is nonnegative.
LazySets.API.translate
— Methodtranslate(X::LazySet, v::AbstractVector)
Compute the translation of a set with a vector.
Input
X
– setv
– vector
Output
A set representing $X + \{v\}$.
LazySets.API.translate
— MethodExtended help
translate(H::Hyperrectangle, v::AbstractVector; [share]::Bool=false)
Input
H
– hyperrectanglev
– translation vectorshare
– (optional, default:false
) flag for sharing unmodified parts of the original set representation
Notes
The radius vector is shared with the original hyperrectangle if share == true
.
Undocumented implementations:
Inherited from LazySet
:
complement
concretize
constraints
convex_hull
copy(::Type{LazySet})
diameter
eltype
eltype
isoperation
singleton_list
surface
vertices
affine_map
exponential_map
is_interior_point
sample
scale
convex_hull
exact_sum
≈
==
isequivalent
⊂
Inherited from ConvexSet
:
Inherited from AbstractPolyhedron
:
Inherited from AbstractPolytope
:
Inherited from AbstractCentrallySymmetricPolytope
:
Inherited from AbstractZonotope
:
Inherited from AbstractHyperrectangle
: