Utility Functions

Utility functions

LazySets.sign_cadlagFunction.
sign_cadlag(x::N)::N where {N<:Real}

This function works like the sign function but is $1$ for input $0$.

Input

  • x – real scalar

Output

$1$ if $x ≥ 0$, $-1$ otherwise.

Notes

This is the sign function right-continuous at zero (see càdlàg function). It can be used with vector-valued arguments via the dot operator.

Examples

julia> import LazySets.sign_cadlag

julia> sign_cadlag.([-0.6, 1.3, 0.0])
3-element Array{Float64,1}:
 -1.0
  1.0
  1.0
source
@neutral(SET, NEUT)

Create functions to make a lazy set operation commutative with a given neutral element set type.

Input

  • SET – lazy set operation type

  • NEUT – set type for neutral element

Output

Nothing.

Notes

This macro generates four functions (possibly two more if @absorbing has been used in advance) (possibly two or four more if @declare_array_version has been used in advance).

Examples

@neutral(MinkowskiSum, N) creates at least the following functions:

  • neutral(::MinkowskiSum) = N

  • MinkowskiSum(X, N) = X

  • MinkowskiSum(N, X) = X

  • MinkowskiSum(N, N) = N

source
@absorbing(SET, ABS)

Create functions to make a lazy set operation commutative with a given absorbing element set type.

Input

  • SET – lazy set operation type

  • ABS – set type for absorbing element

Output

Nothing.

Notes

This macro generates four functions (possibly two more if @neutral has been used in advance) (possibly two or four more if @declare_array_version has been used in advance).

Examples

@absorbing(MinkowskiSum, A) creates at least the following functions:

  • absorbing(::MinkowskiSum) = A

  • MinkowskiSum(X, A) = A

  • MinkowskiSum(A, X) = A

  • MinkowskiSum(A, A) = A

source
@declare_array_version(SET, SETARR)

Create functions to connect a lazy set operation with its array set type.

Input

  • SET – lazy set operation type

  • SETARR – array set type

Output

Nothing.

Notes

This macro generates eight functions (and possibly up to eight more if @neutral/@absorbing has been used in advance for the base and/or array set type).

Examples

@declare_array_version(MinkowskiSum, MinkowskiSumArray) creates at least the following functions:

  • array_constructor(::MinkowskiSum) = MinkowskiSumArray

  • is_array_constructor(::MinkowskiSumArray) = true

  • MinkowskiSum!(X, Y)

  • MinkowskiSum!(X, arr)

  • MinkowskiSum!(arr, X)

  • MinkowskiSum!(arr1, arr2)

source

Helper functions for internal use only

@neutral_absorbing(SET, NEUT, ABS)

Create two functions to avoid method ambiguties for a lazy set operation with respect to neutral and absorbing element set types.

Input

  • SET – lazy set operation type

  • NEUT – set type for neutral element

  • ABS – set type for absorbing element

Output

A quoted expression containing the function definitions.

Examples

@neutral_absorbing(MinkowskiSum, N, A) creates the following functions as quoted expressions:

  • MinkowskiSum(N, A) = A

  • MinkowskiSum(A, N) = A

source
@array_neutral(FUN, NEUT, SETARR)

Create two functions to avoid method ambiguities for a lazy set operation with respect to the neutral element set type and the array set type.

Input

  • FUN – function name

  • NEUT – set type for neutral element

  • SETARR – array set type

Output

A quoted expression containing the function definitions.

Examples

@array_neutral(MinkowskiSum, N, ARR) creates the following functions as quoted expressions:

  • MinkowskiSum(N, ARR) = ARR

  • MinkowskiSum(ARR, N) = ARR

source
@array_absorbing(FUN, ABS, SETARR)

Create two functions to avoid method ambiguities for a lazy set operation with respect to the absorbing element set type and the array set type.

Input

  • FUN – function name

  • ABS – set type for absorbing element

  • SETARR – array set type

Output

A quoted expression containing the function definitions.

Examples

@array_absorbing(MinkowskiSum, ABS, ARR) creates the following functions as quoted expressions:

  • MinkowskiSum(ABS, ARR) = ABS

  • MinkowskiSum(ARR, ABS) = ABS

source