# Singletons (AbstractSingleton)

A singleton is a special hyperrectangle consisting of only one point.

LazySets.AbstractSingletonType
AbstractSingleton{N} <: AbstractHyperrectangle{N}

Abstract type for sets with a single value.

Notes

Every concrete AbstractSingleton must define the following function:

• element(::AbstractSingleton) – return the single element

The following function is then automatically defined:

• element(::AbstractSingleton, i::Int) – return the single element at index i
julia> subtypes(AbstractSingleton)
2-element Vector{Any}:
Singleton
ZeroSet
source

This interface requires to implement the following function:

LazySets.elementMethod
element(S::AbstractSingleton)

Return the element of a set with a single value.

Input

• S – set with a single value

Output

The unique element of S.

source

This interface defines the following functions:

LazySets.API.centerMethod
center(S::AbstractSingleton)

Return the center of a set with a single value.

Input

• S – set with a single value

Output

The center of the set.

source
LazySets.API.centerMethod
center(S::AbstractSingleton, i::Int)

Return the center of a set with a single value in a given dimension.

Input

• S – set with a single value
• i – dimension of interest

Output

The i-th entry of the center of the set.

source
LazySets.elementMethod
element(S::AbstractSingleton, i::Int)

Return the i-th entry of the element of a set with a single value.

Input

• S – set with a single value
• i – dimension of interest

Output

The i-th entry of the element.

source
LazySets.generatorsMethod
generators(S::AbstractSingleton{N}) where {N}

Return an (empty) iterator over the generators of a set with a single value.

Input

• S – set with a single value

Output

An empty iterator.

source
LazySets.genmatMethod

genmat(S::AbstractSingleton{N}) where {N}

Return the (empty) generator matrix of a set with a single value.

Input

• S – set with a single value

Output

A matrix with no columns representing the generators of S.

source
LazySets.API.highMethod
high(S::AbstractSingleton)

Return the higher coordinates of a set with a single value.

Input

• S – set with a single value

Output

A vector with the higher coordinates.

source
LazySets.API.highMethod
high(S::AbstractSingleton, i::Int)

Return the higher coordinate of a set with a single value in the given dimension.

Input

• S – set with a single value
• i – dimension of interest

Output

The higher coordinate in the given dimension.

source
LazySets.API.lowMethod
low(S::AbstractSingleton)

Return the lower coordinates of a set with a single value.

Input

• S – set with a single value

Output

A vector with the lower coordinates.

source
LazySets.API.lowMethod
low(S::AbstractSingleton, i::Int)

Return the lower coordinate of a set with a single value in the given dimension.

Input

• S – set with a single value
• i – dimension of interest

Output

The lower coordinate in the given dimension.

source
LazySets.ngensMethod
ngens(S::AbstractSingleton)

Return the number of generators of a set with a single value.

Input

• H – set with a single value

Output

The number of generators, which is $0$.

source

Return the box radius of a set with a single value in every dimension.

Input

• S – set with a single value

Output

The zero vector.

source

Return the box radius of a set with a single value in a given dimension.

Input

• S – set with a single value
• i – dimension of interest

Output

Zero.

source
LazySets.API.reflectMethod
reflect(S::AbstractSingleton)

Concrete reflection of a set with a single value S, resulting in the reflected set -S.

Input

• S – set with a single value

Output

A Singleton representing -S.

source
LazySets.API.verticesMethod
vertices(S::AbstractSingleton{N}) where {N}

Construct an iterator over the vertices of a set with a single value.

Input

• S – set with a single value

Output

An iterator with a single value.

source
LazySets.API.vertices_listMethod
vertices_list(S::AbstractSingleton)

Return the list of vertices of a set with a single value.

Input

• S – set with a single value

Output

A list containing only a single vertex.

source
Base.:∈Method
∈(x::AbstractVector, S::AbstractSingleton)

Check whether a given point is contained in a set with a single value.

Input

• x – point/vector
• S – set with a single value

Output

true iff $x ∈ S$.

Notes

This implementation performs an approximate comparison to account for imprecision in floating-point computations.

source
LazySets.API.ρMethod
ρ(d::AbstractVector, S::AbstractSingleton)

Evaluate the support function of a set with a single value in a given direction.

Input

• d – direction
• S – set with a single value

Output

The support value in the given direction.

source
LazySets.API.σMethod
σ(d::AbstractVector, S::AbstractSingleton)

Return the support vector of a set with a single value.

Input

• d – direction
• S – set with a single value

Output

The support vector, which is the set's vector itself, irrespective of the given direction.

source
LazySets.plot_recipeMethod
plot_recipe(S::AbstractSingleton{N}, [ε]=zero(N)) where {N}

Convert a singleton to a pair (x, y) of points for plotting.

Input

• S – singleton
• ε – (optional, default: 0) ignored, used for dispatch

Output

A pair (x, y) of one point that can be plotted.

source
RecipesBase.apply_recipeMethod
plot_singleton(S::AbstractSingleton{N}, [ε]::Real=zero(N); ...) where {N}

Plot a singleton.

Input

• S – singleton
• ε – (optional, default: 0) ignored, used for dispatch

Examples

julia> plot(Singleton([0.5, 1.0]))
source