lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::Set Class Referenceabstract

Generic set over a \( \texttip{d}{Dimension of the vector space} \) dimensional vector space \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \). More...

#include <Set.h>

Inheritance diagram for lucid::Set:
lucid::EllipseSet lucid::MultiSet lucid::PolytopeSet lucid::RectSet lucid::SphereSet

Public Member Functions

virtual Dimension dimension () const =0
 Get read-only access to the dimension of the set \( \texttip{\mathcal{X}}{Polish sample vector space} \).
 
virtual Matrix sample (Index num_samples) const =0
 Extract \( N \) elements from \( \texttip{\mathcal{X}}{Polish sample vector space} \) using some kind of random distribution.
 
Vector sample () const
 Extract an element from \( \texttip{\mathcal{X}}{Polish sample vector space} \) using some kind of random distribution.
 
bool contains (ConstVectorRef x) const
 Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \).
 
bool contains_wrapped (ConstVectorRef x, ConstVectorRef period, Dimension num_periods) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool contains_wrapped (ConstVectorRef x, ConstVectorRef period, const std::vector< Dimension > &num_periods) const
 Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \), having the vector wrapped around a given period.
 
bool contains_wrapped (ConstVectorRef x, ConstVectorRef period, Dimension num_periods_below, Dimension num_periods_above) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool contains_wrapped (ConstVectorRef x, ConstVectorRef period, const std::vector< Dimension > &num_periods_below, const std::vector< Dimension > &num_periods_above) const
 Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \), having the vector wrapped around a given period.
 
bool contains_wrapped (ConstVectorRef x, ConstVectorRef period) const
 Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \), having the vector wrapped around a given period.
 
Matrix include (ConstMatrixRef xs) const
 Filter a set xs, returning only the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \).
 
std::vector< Index > include_mask (ConstMatrixRef xs) const
 Filter a set xs, returning a mask containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \).
 
std::vector< Index > include_mask_wrapped (ConstMatrixRef xs, ConstVectorRef period) const
 Filter a set xs, returning a mask containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \), accounting for wrapping around a given period.
 
Matrix exclude (ConstMatrixRef xs) const
 Filter xs, return only the row vectors that are NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \).
 
std::vector< Index > exclude_mask (ConstMatrixRef xs) const
 Filter a set xs, returning a mask containing the indices corresponding to the row vectors that are NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \).
 
std::vector< Index > exclude_mask_wrapped (ConstMatrixRef xs, ConstVectorRef period) const
 Filter a set xs, returning a mask containing the indices corresponding to the row vectors that are NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \), accounting for wrapping around a given period.
 
std::pair< std::vector< Index >, std::vector< Index > > include_exclude_masks (ConstMatrixRef xs) const
 Filter a set xs, returning masks containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \) and NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \).
 
std::pair< std::vector< Index >, std::vector< Index > > include_exclude_masks_wrapped (ConstMatrixRef xs, ConstVectorRef period) const
 Filter a set xs, returning masks containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \) and NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \), accounting for wrapping around a given period.
 
std::pair< std::vector< Index >, std::vector< Index > > include_exclude_masks_wrapped (ConstMatrixRef xs, const RectSet &period) const
 Filter a set xs, returning masks containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \) and NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \), accounting for wrapping around a given period.
 
virtual bool operator() (ConstVectorRef x) const =0
 Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \).
 
std::unique_ptr< Setscale_wrapped (double scale, const RectSet &bounds, bool relative_to_bounds=false) const
 Scale the set by the given factor while keeping it inside the given bounds.
 
std::unique_ptr< Setscale_wrapped (ConstVectorRef scale, const RectSet &bounds, bool relative_to_bounds=false) const
 Scale the set by the given factor while keeping it inside the given bounds.
 
template<bool Inplace = false>
requires (!Inplace)
std::unique_ptr< Setincrease_size (ConstVectorRef size_increase) const
 Increase the size of the set.
 
template<bool Inplace = false>
requires (Inplace)
void increase_size (ConstVectorRef size_increase)
 Increase the size of the set.
 
void change_size (double delta_size)
 Change the size of the set.
 
virtual void change_size (ConstVectorRef delta_size)
 Change the size of the set.
 
Matrix lattice (Index points_per_dim, bool endpoint=false) const
 Generate a lattice of points in the set.
 
virtual Matrix lattice (const VectorI &points_per_dim, bool endpoint) const =0
 Generate a lattice of points in the set.
 
virtual std::unique_ptr< Setto_rect_set () const
 Convert the set to a rectangular set.
 
virtual std::unique_ptr< Setto_anisotropic () const
 Create a new anisotropic set.
 
virtual Vector general_lower_bound () const
 Get read-only access to the lower bound of the smallest rectangular set including the whole set.
 
virtual Vector general_upper_bound () const
 Get read-only access to the upper bound of the smallest rectangular set including the whole set.
 
template<class Derived>
Eigen::MatrixBase< Derived > & operator>> (Eigen::MatrixBase< Derived > &x) const
 Extract \( N \) elements element from \( \texttip{\mathcal{X}}{Polish sample vector space} \) using some kind of random distribution, where \( N \) is the number of rows in \( \texttip{x}{Element of the vector space} \).
 
virtual std::string to_string () const
 Obtain the string representation of this object.
 
virtual std::unique_ptr< Setclone () const =0
 Clone the set.
 

Protected Member Functions

virtual std::unique_ptr< Setscale_wrapped_impl (ConstVectorRef scale, const RectSet &bounds, bool relative_to_bounds) const
 Scale the rectangular set by the given factor while keeping it inside the given bounds.
 
virtual void increase_size_impl (ConstVectorRef size_increase)
 Increase the size of the set.
 

Detailed Description

Generic set over a \( \texttip{d}{Dimension of the vector space} \) dimensional vector space \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \).

It can be used to test if a vector is in the set and to sample elements from the set.

Member Function Documentation

◆ change_size() [1/2]

void lucid::Set::change_size ( ConstVectorRef delta_size)
virtual

Change the size of the set.

The size change can be different for each dimension. For example, for a rectangular set, this would change the lower and upper bounds so that the original set sits in the center of the new set, which has its size changed by the specified amounts.

Precondition
The set must support size changes.
The size of delta_size must be equal to the dimension of the set.
The new size must be non-negative in all dimensions.
Parameters
delta_sizevector of amounts to change the size of the set for each dimension

Reimplemented in lucid::EllipseSet, lucid::MultiSet, lucid::RectSet, and lucid::SphereSet.

◆ change_size() [2/2]

void lucid::Set::change_size ( double delta_size)

Change the size of the set.

The size change can be different for each dimension. For example, for a rectangular set, this would change the lower and upper bounds so that the original set sits in the center of the new set, which has its size changed by the specified amounts.

Precondition
The set must support size changes.
The new size must be non-negative in all dimensions.
Parameters
delta_sizeamount to change the size of the set

◆ clone()

virtual std::unique_ptr< Set > lucid::Set::clone ( ) const
nodiscardpure virtual

Clone the set.

Create a new instance of the set with the same properties as the current one.

Returns
new instance of the set

Implemented in lucid::EllipseSet, lucid::MultiSet, lucid::PolytopeSet, lucid::RectSet, and lucid::SphereSet.

◆ contains()

bool lucid::Set::contains ( ConstVectorRef x) const
inlinenodiscard

Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \).

Precondition
\( \texttip{x}{Element of the vector space} \) must have the same dimension as the set
Parameters
xvector to test
Returns
true if \( \texttip{x}{Element of the vector space} \) is in the set
false if \( \texttip{x}{Element of the vector space} \) is not in the set

◆ contains_wrapped() [1/3]

bool lucid::Set::contains_wrapped ( ConstVectorRef x,
ConstVectorRef period ) const
nodiscard

Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \), having the vector wrapped around a given period.

Given a point x, we assume that the space is tiled every period units in each dimension, and we check if any of the tiled copies of x is in the set. Graphically,

┌-----┼-----------┐
|x │x x |
| │ |
| ├─────┐ |
|x │x │x |
─┼─────┼─────┴─────┼►
| │ |
|x │x x |
└-----┼-----------┘

where the continuous rectangular area in the middle represents the periodic space. The original point is indicated by the x in the middle, while all other xs represent the additional points that will be checked for membership in the set. The number of xs in each direction is determined using general_lower_bound and general_upper_bound with respect to the given period.

Note
The periodic set starts at the origin.
Precondition
\( \texttip{x}{Element of the vector space} \) must have the same dimension as the set
\( \texttip{x}{Element of the vector space} \) must fall in the range defined by [0, period) in all dimensions
period must be strictly positive in all dimensions.
Parameters
xvector to test
periodperiod for wrapping around
Returns
true if any of the wrapped copies of \( \texttip{x}{Element of the vector space} \) is in the set
false if none of the wrapped copies of \( \texttip{x}{Element of the vector space} \) is in the set

◆ contains_wrapped() [2/3]

bool lucid::Set::contains_wrapped ( ConstVectorRef x,
ConstVectorRef period,
const std::vector< Dimension > & num_periods ) const
nodiscard

Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \), having the vector wrapped around a given period.

Given a point x, we assume that the space is tiled every period units in each dimension, and we check if any of the tiled copies of x is in the set. Graphically,

┌-----┼-----------┐
|x │x x |
| │ |
| ├─────┐ |
|x │x │x |
─┼─────┼─────┴─────┼►
| │ |
|x │x x |
└-----┼-----------┘

where the continuous rectangular area in the middle represents the periodic space. The original point is indicated by the x in the middle, while all other xs represent the additional points that will be checked for membership in the set, given that num_periods is set to 1. The wrapping is done by shifting x by integer multiples of period in each dimension, up to the specified num_periods.

Note
The periodic set starts at the origin.
Precondition
\( \texttip{x}{Element of the vector space} \) must have the same dimension as the set.
\( \texttip{x}{Element of the vector space} \) must fall in the range defined by [0, period) in all dimensions.
period must be strictly positive in all dimensions.
The set must fit inside the box defined by [-num_periods * period, num_periods * period] in all dimensions.
Parameters
xvector to test
periodperiod for wrapping around
num_periodsnumber of periods to consider in each direction
Returns
true if any of the wrapped copies of \( \texttip{x}{Element of the vector space} \) is in the set
false if none of the wrapped copies of \( \texttip{x}{Element of the vector space} \) is in the set

◆ contains_wrapped() [3/3]

bool lucid::Set::contains_wrapped ( ConstVectorRef x,
ConstVectorRef period,
const std::vector< Dimension > & num_periods_below,
const std::vector< Dimension > & num_periods_above ) const
nodiscard

Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \), having the vector wrapped around a given period.

Given a point x, we assume that the space is tiled every period units in each dimension, and we check if any of the tiled copies of x is in the set. Graphically,

┼-----------┐
│x x |
│ |
├─────┐ |
│x │x |
─┼─────┴─────┼►

where the continuous rectangular area in the middle represents the periodic space. The original point is indicated by the x in the middle, while all other xs represent the additional points that will be checked for membership in the set, given that num_periods_below is set to 0 and num_periods_above is set to 1 (for all dimensions). The wrapping is done by shifting x by integer multiples of period in each dimension, up to the specified num_periods.

Note
The periodic set starts at the origin.
Precondition
\( \texttip{x}{Element of the vector space} \) must have the same dimension as the set.
\( \texttip{x}{Element of the vector space} \) must fall in the range defined by [0, period) in all dimensions.
period must be strictly positive in all dimensions.
num_periods_below and num_periods_above must have the same size as the dimension of the set.
num_periods_below and num_periods_above must be non-negative in all dimensions.
The set must fit inside the box defined by [-num_periods_below * period, num_periods_above * period] in all dimensions.
Parameters
xvector to test
periodperiod for wrapping around
num_periods_belownumber of periods below the original periodic set to consider in each direction
num_periods_abovenumber of periods above the original periodic set to consider in each direction
Returns
true if any of the wrapped copies of \( \texttip{x}{Element of the vector space} \) is in the set
false if none of the wrapped copies of \( \texttip{x}{Element of the vector space} \) is in the set

◆ dimension()

virtual Dimension lucid::Set::dimension ( ) const
nodiscardpure virtual

Get read-only access to the dimension of the set \( \texttip{\mathcal{X}}{Polish sample vector space} \).

Returns
dimension of the set \( \texttip{\mathcal{X}}{Polish sample vector space} \)

Implemented in lucid::EllipseSet, lucid::MultiSet, lucid::PolytopeSet, lucid::RectSet, and lucid::SphereSet.

◆ exclude()

Matrix lucid::Set::exclude ( ConstMatrixRef xs) const
nodiscard

Filter xs, return only the row vectors that are NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \).

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
Returns
matrix of row vectors that are NOT in the set

◆ exclude_mask()

std::vector< Index > lucid::Set::exclude_mask ( ConstMatrixRef xs) const
nodiscard

Filter a set xs, returning a mask containing the indices corresponding to the row vectors that are NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \).

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
Returns
vector of indices corresponding to the vectors that are NOT in the set

◆ exclude_mask_wrapped()

std::vector< Index > lucid::Set::exclude_mask_wrapped ( ConstMatrixRef xs,
ConstVectorRef period ) const
nodiscard

Filter a set xs, returning a mask containing the indices corresponding to the row vectors that are NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \), accounting for wrapping around a given period.

This method is a variation of exclude_mask that uses contains_wrapped to test membership.

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
All vectors in xs must fall in the range defined by [0, period) in all dimensions
period must be strictly positive in all dimensions.
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
periodperiod for wrapping around
Returns
vector of indices corresponding to the vectors that are in the set

◆ general_lower_bound()

Vector lucid::Set::general_lower_bound ( ) const
nodiscardvirtual

Get read-only access to the lower bound of the smallest rectangular set including the whole set.

Returns
lower bound of the smallest rectangular set including the whole set

Reimplemented in lucid::EllipseSet, lucid::MultiSet, lucid::RectSet, and lucid::SphereSet.

◆ general_upper_bound()

Vector lucid::Set::general_upper_bound ( ) const
nodiscardvirtual

Get read-only access to the upper bound of the smallest rectangular set including the whole set.

Returns
upper bound of the smallest rectangular set including the whole set

Reimplemented in lucid::EllipseSet, lucid::MultiSet, lucid::RectSet, and lucid::SphereSet.

◆ include()

Matrix lucid::Set::include ( ConstMatrixRef xs) const
nodiscard

Filter a set xs, returning only the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \).

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
Returns
matrix of row vectors that are in the set

◆ include_exclude_masks()

std::pair< std::vector< Index >, std::vector< Index > > lucid::Set::include_exclude_masks ( ConstMatrixRef xs) const
nodiscard

Filter a set xs, returning masks containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \) and NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \).

The union of the two sets of indices covers all the indices of xs.

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
Returns
pair of vectors of indices where
  • the first vector contains the indices corresponding to the vectors that are in the set
  • the second vector contains the indices corresponding to the vectors that are NOT in the set

◆ include_exclude_masks_wrapped() [1/2]

std::pair< std::vector< Index >, std::vector< Index > > lucid::Set::include_exclude_masks_wrapped ( ConstMatrixRef xs,
const RectSet & period ) const
nodiscard

Filter a set xs, returning masks containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \) and NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \), accounting for wrapping around a given period.

The union of the two sets of indices covers all the indices of xs. This method is a variation of include_exclude_masks that uses contains_wrapped to test membership.

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
All vectors in xs must be contained in the period set
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
periodperiod for wrapping around
Returns
pair of vectors of indices where
  • the first vector contains the indices corresponding to the vectors that are in the set (wrapped)
  • the second vector contains the indices corresponding to the vectors that are NOT in the set (wrapped)

◆ include_exclude_masks_wrapped() [2/2]

std::pair< std::vector< Index >, std::vector< Index > > lucid::Set::include_exclude_masks_wrapped ( ConstMatrixRef xs,
ConstVectorRef period ) const
nodiscard

Filter a set xs, returning masks containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \) and NOT in \( \texttip{\mathcal{X}}{Polish sample vector space} \), accounting for wrapping around a given period.

The union of the two sets of indices covers all the indices of xs. This method is a variation of include_exclude_masks that uses contains_wrapped to test membership.

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
All vectors in xs must fall in the range defined by [0, period) in all dimensions
period must be strictly positive in all dimensions.
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
periodperiod for wrapping around
Returns
pair of vectors of indices where
  • the first vector contains the indices corresponding to the vectors that are in the set (wrapped)
  • the second vector contains the indices corresponding to the vectors that are NOT in the set (wrapped)

◆ include_mask()

std::vector< Index > lucid::Set::include_mask ( ConstMatrixRef xs) const
nodiscard

Filter a set xs, returning a mask containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \).

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
Returns
vector of indices corresponding to the vectors that are in the set

◆ include_mask_wrapped()

std::vector< Index > lucid::Set::include_mask_wrapped ( ConstMatrixRef xs,
ConstVectorRef period ) const
nodiscard

Filter a set xs, returning a mask containing the indices corresponding to the row vectors that are in \( \texttip{\mathcal{X}}{Polish sample vector space} \), accounting for wrapping around a given period.

This method is a variation of include_mask that uses contains_wrapped to test membership.

Precondition
xs must have the same number of columns as the dimension of the set, \( \texttip{d}{Dimension of the vector space} \)
All vectors in xs must fall in the range defined by [0, period) in all dimensions
period must be strictly positive in all dimensions.
Parameters
xs\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of row vectors to filter
periodperiod for wrapping around
Returns
vector of indices corresponding to the vectors that are in the set

◆ increase_size() [1/2]

template<bool Inplace>
requires (Inplace)
template void lucid::Set::increase_size< true > ( ConstVectorRef size_increase)

Increase the size of the set.

The size increase can be different for each dimension. The increase is applied symmetrically around the center of the set such that the total size after the increase is equal to the original size plus size_increase.

Precondition
The set must support size changes.
The size of scale must be equal to the dimension of the set.
The new size must be non-negative in all dimensions.
Parameters
size_increaseamount to increase the size of the set for each dimension
Returns
new set with increased size

◆ increase_size() [2/2]

template<bool Inplace>
requires (!Inplace)
template std::unique_ptr< Set > lucid::Set::increase_size< false > ( ConstVectorRef size_increase) const
nodiscard

Increase the size of the set.

The size increase can be different for each dimension. The increase is applied symmetrically around the center of the set such that the total size after the increase is equal to the original size plus size_increase.

Precondition
The set must support size changes.
The size of scale must be equal to the dimension of the set.
The new size must be non-negative in all dimensions.
Parameters
size_increaseamount to increase the size of the set for each dimension
Returns
new set with increased size

◆ increase_size_impl()

void lucid::Set::increase_size_impl ( ConstVectorRef size_increase)
protectedvirtual

Increase the size of the set.

The size increase can be different for each dimension. The increase is applied symmetrically around the center of the set such that the total size after the increase is equal to the original size plus size_increase.

Precondition
The set must support size changes.
The size of scale must be equal to the dimension of the set.
The new size must be non-negative in all dimensions.
Parameters
size_increaseamount to increase the size of the set for each dimension

Reimplemented in lucid::EllipseSet, lucid::MultiSet, lucid::RectSet, and lucid::SphereSet.

◆ lattice() [1/2]

virtual Matrix lucid::Set::lattice ( const VectorI & points_per_dim,
bool endpoint ) const
nodiscardpure virtual

Generate a lattice of points in the set.

Parameters
points_per_dimnumber of points per each dimension
endpointwhether to include the endpoints of the lattice
Returns
lattice of points in the set

Implemented in lucid::EllipseSet, lucid::MultiSet, lucid::PolytopeSet, lucid::RectSet, and lucid::SphereSet.

◆ lattice() [2/2]

Matrix lucid::Set::lattice ( Index points_per_dim,
bool endpoint = false ) const
nodiscard

Generate a lattice of points in the set.

Parameters
points_per_dimnumber of points per each dimension
endpointwhether to include the endpoints of the lattice
Returns
lattice of points in the set

◆ operator()()

virtual bool lucid::Set::operator() ( ConstVectorRef x) const
nodiscardpure virtual

Check if a vector is in \( \texttip{\mathcal{X}}{Polish sample vector space} \).

Precondition
\( \texttip{x}{Element of the vector space} \) must have the same dimension as the set
Parameters
xvector to test
Returns
true if \( \texttip{x}{Element of the vector space} \) is in the set
false if \( \texttip{x}{Element of the vector space} \) is not in the set

Implemented in lucid::EllipseSet, lucid::MultiSet, lucid::PolytopeSet, lucid::RectSet, and lucid::SphereSet.

◆ operator>>()

template<class Derived>
Eigen::MatrixBase< Derived > & lucid::Set::operator>> ( Eigen::MatrixBase< Derived > & x) const
inline

Extract \( N \) elements element from \( \texttip{\mathcal{X}}{Polish sample vector space} \) using some kind of random distribution, where \( N \) is the number of rows in \( \texttip{x}{Element of the vector space} \).

Parameters
[out]x\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix to store the elements
Returns
\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of samples, where \( \texttip{d}{Dimension of the vector space} \) is the dimension of \( \texttip{\mathcal{X}}{Polish sample vector space} \).

◆ sample() [1/2]

Vector lucid::Set::sample ( ) const
nodiscard

Extract an element from \( \texttip{\mathcal{X}}{Polish sample vector space} \) using some kind of random distribution.

Note
The seed for the random number generator can be set using random::seed.
Returns
element of the set

◆ sample() [2/2]

virtual Matrix lucid::Set::sample ( Index num_samples) const
nodiscardpure virtual

Extract \( N \) elements from \( \texttip{\mathcal{X}}{Polish sample vector space} \) using some kind of random distribution.

Note
The seed for the random number generator can be set using random::seed.
Precondition
num_samples must be greater than 0
Parameters
num_samplesnumber of samples to generate \( N \)
Returns
\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) matrix of samples, where \( \texttip{d}{Dimension of the vector space} \) is the dimension of \( \texttip{\mathcal{X}}{Polish sample vector space} \). In other words, the samples are stored as rows vectors in the matrix

Implemented in lucid::EllipseSet, lucid::MultiSet, lucid::PolytopeSet, lucid::RectSet, and lucid::SphereSet.

◆ scale_wrapped() [1/2]

std::unique_ptr< Set > lucid::Set::scale_wrapped ( ConstVectorRef scale,
const RectSet & bounds,
bool relative_to_bounds = false ) const
nodiscard

Scale the set by the given factor while keeping it inside the given bounds.

If any dimension exceeds the bounds after scaling, it is wrapped around to the other side, as another set. The scaling is performed with respect to the center of the set. The scaling factor can be computed relative to either

  • the current size of the set;
  • the size of the bounding rectangular set.
    Parameters
    scalescaling factor per dimension
    boundsbounding rectangular set
    relative_to_boundsif true, the scaling factor is computed relative to the size of the bounding rectangular set; if false, the scaling factor is computed relative to the current size of the rectangular
    Returns
    new scaled set

◆ scale_wrapped() [2/2]

std::unique_ptr< Set > lucid::Set::scale_wrapped ( double scale,
const RectSet & bounds,
bool relative_to_bounds = false ) const
nodiscard

Scale the set by the given factor while keeping it inside the given bounds.

If any dimension exceeds the bounds after scaling, it is wrapped around to the other side, as another set. The scaling is performed with respect to the center of the set. The scaling factor can be computed relative to either

  • the current size of the set;
  • the size of the bounding rectangular set.
    Parameters
    scalescaling factor
    boundsbounding rectangular set
    relative_to_boundsif true, the scaling factor is computed relative to the size of the bounding rectangular set; if false, the scaling factor is computed relative to the current size of the rectangular
    Returns
    new scaled set

◆ scale_wrapped_impl()

std::unique_ptr< Set > lucid::Set::scale_wrapped_impl ( ConstVectorRef scale,
const RectSet & bounds,
bool relative_to_bounds ) const
nodiscardprotectedvirtual

Scale the rectangular set by the given factor while keeping it inside the given bounds.

If any dimension exceeds the bounds after scaling, it is wrapped around to the other side, as another rectangular set. The scaling is performed with respect to the center of the rectangular set. The scaling factor can be computed relative to either

  • the current size of the rectangular set;
  • the size of the bounding rectangular set.
    Parameters
    scalescaling factor
    boundsbounding rectangular set
    relative_to_boundsif true, the scaling factor is computed relative to the size of the bounding rectangular set; if false, the scaling factor is computed relative to the current size of the rectangular
    Returns
    new scaled rectangular set

Reimplemented in lucid::MultiSet, and lucid::RectSet.

◆ to_anisotropic()

std::unique_ptr< Set > lucid::Set::to_anisotropic ( ) const
nodiscardvirtual

Create a new anisotropic set.

The set should remain the same, but it will allow for different scaling factors in each dimension. If the set is already anisotropic, it should return a clone of itself.

Returns
unique pointer to the new anisotropic set

Reimplemented in lucid::MultiSet, and lucid::SphereSet.

◆ to_rect_set()

std::unique_ptr< Set > lucid::Set::to_rect_set ( ) const
nodiscardvirtual

Convert the set to a rectangular set.

Not all sets can be converted to rectangular sets. If the set cannot be converted, an exception is thrown.

Returns
unique pointer to the rectangular set

Reimplemented in lucid::EllipseSet, lucid::MultiSet, lucid::RectSet, and lucid::SphereSet.

◆ to_string()

std::string lucid::Set::to_string ( ) const
nodiscardvirtual

Obtain the string representation of this object.

Returns
string representation of this object

Reimplemented in lucid::EllipseSet, lucid::MultiSet, lucid::PolytopeSet, lucid::RectSet, and lucid::SphereSet.


The documentation for this class was generated from the following files: