random_events.sigma_algebra#
Attributes#
Classes#
Abstract class for simple sets. |
|
Abstract class for composite sets. |
Module Contents#
- random_events.sigma_algebra.EMPTY_SET_SYMBOL = '∅'#
- class random_events.sigma_algebra.AbstractSimpleSet#
Bases:
random_events.utils.SubclassJSONSerializer,random_events.utils.CPPWrapperAbstract class for simple sets.
Simple sets are sets that can be represented as a single object.
This class is a wrapper for the C++ class AbstractSimpleSet.
- _cpp_object: random_events_lib.AbstractSimpleSet#
The C++ object that this class wraps.
- intersection_with(other: typing_extensions.Self) typing_extensions.Self#
Form the intersection of this object with another object.
- Parameters:
other – The other SimpleSet
- Returns:
The intersection of this set with the other set
- complement() SimpleSetContainer#
- Returns:
The complement of this set as disjoint set of simple sets.
- is_empty() bool#
- Returns:
Rather this set is empty or not.
- abstract contains(item) bool#
Check if this set contains an item. :param item: The item to check :return: Rather if the item is in the set or not
- __hash__()#
- abstract non_empty_to_string() str#
- Returns:
A string representation of this set if it is not empty.
- difference_with(other: typing_extensions.Self) SimpleSetContainer#
Form the difference of this object with another object.
- Parameters:
other – The other SimpleSet
- Returns:
The difference as a disjoint set of simple sets.
- to_string()#
- Returns:
A string representation of this set.
- __str__()#
- __repr__()#
- __lt__(other: typing_extensions.Self)#
- __eq__(other)#
- abstract as_composite_set() AbstractCompositeSet#
Convert this simple set to a composite set.
- Returns:
The composite set
- abstract __deepcopy__()#
- class random_events.sigma_algebra.AbstractCompositeSet#
Bases:
random_events.utils.SubclassJSONSerializer,random_events.utils.CPPWrapper,abc.ABCAbstract class for composite sets.
AbstractCompositeSet is a set composed of a union of simple sets. If any operation is called on this, the resulting union will also be disjoint and simplified. A simplified composite set is a set with as few simple sets in it as possible to represent the necessary information.
This class wraps the C++ class AbstractCompositeSet.
- _cpp_object: random_events_lib.AbstractCompositeSet#
The C++ object that this class wraps.
- simple_set_example: AbstractSimpleSet#
An example of a simple set that is used to create new simple sets. Fields that are python only are read from this instance when reading from cpp.
- property simple_sets: SimpleSetContainer#
- Returns:
The simple sets contained in the union described by this set.
- union_with(other: typing_extensions.Self) typing_extensions.Self#
- Parameters:
other – The other set
- Returns:
The union of this set with the other set
- __or__(other: typing_extensions.Self) typing_extensions.Self#
- intersection_with(other: typing_extensions.Self) typing_extensions.Self#
- Parameters:
other – The other set
- Returns:
The intersection of this set with the other set
- __and__(other) typing_extensions.Self#
- difference_with(other: typing_extensions.Self) typing_extensions.Self#
- Parameters:
other – The other set
- Returns:
The difference of this set with the other set
- __sub__(other) typing_extensions.Self#
- complement() typing_extensions.Self#
- Returns:
The complement of this set
- __invert__() typing_extensions.Self#
- is_empty() bool#
- Returns:
If this set is empty or not.
- contains(item) bool#
- Parameters:
item – The item to check
- Returns:
If the item is in the set or not
- __contains__(item) bool#
- to_string() str#
- Returns:
A string representation of this set.
- __str__() str#
- __repr__() str#
- is_disjoint() bool#
- Returns:
If the union described by this is disjoint or not.
- make_disjoint() typing_extensions.Self#
Create an equal composite set that contains a disjoint union of simple sets.
- Returns:
The disjoint set.
- add_simple_set(simple_set: AbstractSimpleSet)#
Add a simple set to this composite set if it is not empty.
- Parameters:
simple_set – The simple set to add
- simplify() typing_extensions.Self#
Simplify this set into an equivalent, more compact version.
- Returns:
The simplified set
- __eq__(other: typing_extensions.Self) bool#
- __hash__() int#
- __iter__() typing_extensions.Iterable[AbstractSimpleSet]#
- __lt__(other: typing_extensions.Self)#
Compare this set with another set. The sets are compared by comparing the simple sets in order. If the pair of simple sets are equal, the next pair is compared. If all pairs are equal, the set with the least amount of simple sets is considered smaller.
- ..note:: This does not define a total order in the mathematical sense. In the mathematical sense, this defines
a partial order.
- Parameters:
other – The other set
- Returns:
Rather this set is smaller than the other set
- to_json() Dict[str, Any]#
- classmethod _from_json(data: Dict[str, Any]) typing_extensions.Self#
Create a variable from a json dict. This method is called from the from_json method after the correct subclass is determined and should be overwritten by the respective subclass.
- Parameters:
data – The json dict
- Returns:
The deserialized object
- __deepcopy__()#
- random_events.sigma_algebra.SimpleSetContainer#