algebraixlib.algebras.multiclans module¶
This module contains the algebra of multiclans and related functionality.
A multiclan is also a multiset (of relations), and inherits all operations
of the algebra of multisets. These are provided in multisets.
-
class
algebraixlib.algebras.multiclans.Algebra[source]¶ Bases:
objectProvide the operations and relations that are members of the algebra of multiclans.
This class contains only static member functions. Its main purpose is to provide a namespace for and highlight the operations and relations that belong to the algebra of multiclans. All member functions are also available at the enclosing module scope.
-
static
transpose()[source]¶ Return a multiclan where all relations have their left and right components swapped.
Returns: The unary multi-extension of transposition from the algebra of relations to the algebra of multiclans, applied to multiclan, orUndef()ifmulticlanis not a multiclan.
-
static
compose()[source]¶ Return the composition of
multiclan1withmulticlan2.Returns: The binary multi-extension of composition from the algebra of relations to the algebra of multiclans, applied to multiclan1andmulticlan2, orUndef()ifmulticlan1ormulticlan2are not multiclans.
-
static
cross_union()[source]¶ Return the cross-union of
mclan1andmclan2.Returns: The binary multi-extension of union from the algebra of relations (which inherits it from the algebra of sets) to the algebra of multiclans applied to mclan1andmclan2, orUndef()ifmclan1ormclan2are not multiclans.
-
static
cross_functional_union()[source]¶ Return the cross-functional union of
mclan1andmclan2.Returns: The binary multi-extension of the functional union from the algebra of relations to the algebra of multiclans, applied to mclan1andmclan2, orUndef()ifmclan1ormclan2are not multiclans.
-
static
cross_right_functional_union()[source]¶ Return the cross-right-functional union of
multiclan1andmulticlan2.Returns: The binary multi-extension of the right-functional union from the algebra of relations to the algebra of multiclans, applied to multiclan1andmulticlan2, orUndef()ifmulticlan1ormulticlan2are not multiclans.
-
static
cross_intersect()[source]¶ Return the cross-intersection of
multiclan1andmulticlan2.Returns: The binary multi-extension of intersection from the algebra of relations (which inherits it from the algebra of sets) to the algebra of multiclans applied to multiclan1andmulticlan2, orUndef()ifmulticlan1ormulticlan2are not multiclans.
-
static
substrict()[source]¶ Return the substriction of
multiclan1andmulticlan2.The substriction of two multiclans is a multiclan that contains all relations from
multiclan1that are a submultiset of a relation frommulticlan2.Returns: The binary multi-extension of substriction from the algebra of relations (which inherits it from the algebra of sets) to the algebra of multiclans applied to multiclan1andmulticlan2, orUndef()ifmulticlan1ormulticlan2are not multiclans.
-
static
superstrict()[source]¶ Return the superstriction of
multiclan1andmulticlan2.The superstriction of two multiclans is a multiclan that contains all relations from
multiclan1that are a supermultiset of a relation frommulticlan2.Returns: The binary multi-extension of superstriction from the algebra of relations (which inherits it from the algebra of sets) to the algebra of multiclans applied to multiclan1andmulticlan2, orUndef()ifmulticlan1ormulticlan2are not multiclans.
-
static
-
algebraixlib.algebras.multiclans.transpose()¶ Convenience redirection to
Algebra.transpose.
-
algebraixlib.algebras.multiclans.compose()¶ Convenience redirection to
Algebra.compose.
-
algebraixlib.algebras.multiclans.cross_union()¶ Convenience redirection to
Algebra.cross_union.
-
algebraixlib.algebras.multiclans.cross_functional_union()¶ Convenience redirection to
Algebra.cross_functional_union.
-
algebraixlib.algebras.multiclans.cross_right_functional_union()¶ Convenience redirection to
Algebra.cross_right_functional_union.
-
algebraixlib.algebras.multiclans.cross_intersect()¶ Convenience redirection to
Algebra.cross_intersect.
-
algebraixlib.algebras.multiclans.substrict()¶ Convenience redirection to
Algebra.substrict.
-
algebraixlib.algebras.multiclans.superstrict()¶ Convenience redirection to
Algebra.superstrict.
-
algebraixlib.algebras.multiclans.get_name() → str[source]¶ Return the name and ground set of this algebra in string form.
-
algebraixlib.algebras.multiclans.get_ground_set() → algebraixlib.structure.Structure[source]¶ Return the ground set of this algebra.
-
algebraixlib.algebras.multiclans.get_absolute_ground_set() → algebraixlib.structure.Structure[source]¶ Return the absolute ground set of this algebra.
-
algebraixlib.algebras.multiclans.is_member(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return whether
objis a member of the ground set of this algebra.return: Trueifobjis a multiclan,Falseif not.Note
This function may call
get_ground_set()onobj. The result of this operation is cached.
-
algebraixlib.algebras.multiclans.is_member_or_undef(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ - Return whether
objis either a member of the ground set of this algebra - or
Undef.
Returns: Trueifobjis either a relation orUndef,Falseif not.- Return whether
-
algebraixlib.algebras.multiclans.is_absolute_member(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return whether
objis a member of the absolute ground set of this algebra.return: Trueifobjis an absolute clan,Falseif not.Note
This function may call
get_ground_set()onobj. The result of this operation is cached.
-
algebraixlib.algebras.multiclans.get_lefts()[source]¶ Return the set of the left components of all couplets in all relations in
mclan.Returns: The union of the left sets of all relations in mclanorUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.get_rights()[source]¶ Return the set of the right components of all couplets in all relations in
mclan.Returns: The union of the right sets of all relations in mclanorUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.get_rights_for_left()[source]¶ Return the multiset of the right components of all couplets in the multiclan
mclanassociated with the left componentleft.Returns: The right multiset of the multiclan mclanassociated with the left componentleftorUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.is_functional(mclan, _checked=True) → bool[source]¶ Return whether
mclanis functional.Returns: Trueif every relation inmclanis functional (is a function),Falseif not, orUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.is_right_functional(mclan, _checked=True) → bool[source]¶ Return whether
mclanis right-functional.Returns: Trueif every relation inmclanis right-functional,Falseif not, orUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.is_regular(mclan, _checked=True) → bool[source]¶ Return whether
mclanis (left-)regular.Returns: Trueifmclanis regular,Falseif not, orUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.is_right_regular(mclan, _checked=True) → bool[source]¶ Return whether
mclanis right-regular.Returns: Trueifmclanis right-regular,Falseif not, orUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.is_reflexive(mclan, _checked=True) → bool[source]¶ Return whether
mclanis reflexive.Returns: Trueifmclanis reflexive,Falseif it is not, orUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.is_symmetric(mclan, _checked=True) → bool[source]¶ Return whether
mclanis symmetric.Returns: Trueifmclanis symmetric,Falseif it is not, orUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.is_transitive(mclan, _checked=True) → bool[source]¶ Return whether
mclanis transitive.Returns: Trueifmclanis transitive,Falseif it is not, orUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.project()[source]¶ Return a multiclan that contains only the couplets with lefts from
mclanthat matchlefts.Parameters: - mclan – The source data. Must be a multiclan.
- lefts – The names of the left components to match. (If you want to pass in an
iterable, you need to prefix it with an asterisk
*.)
Returns: The projection of
mclan(a multiclan that contains only couplets with left components as indicated bylefts), orUndef()ifmclanis not a multiclan.
-
algebraixlib.algebras.multiclans.multiclan_to_listgen()[source]¶ Return a generator expression for a list of tuples that contains the relations with indices
offset <= index < offset + limit. Note that because of the lack of order the result is not deterministic when usingoffsetorlimit. (See alsoorder_slice_to_listgen.) Each tuple contains a relation and its multiplicity.Parameters: - mclan – The source data. Must be a multiclan.
- offset – An atom with an integer value that indicates the index of the first
relation (after sorting the multiclan) in the result. Set to
Atom(0)if you want to start with the first relation of the sorted multiclan. - limit – An atom with an integer value that indicates how many relations should be in
the resulting multiclan. When
limitisfloat('inf'), all relations are returned.
-
algebraixlib.algebras.multiclans.order_slice_to_listgen()[source]¶ Return a generator expression for a list of tuples that contains the relations with indices
offset <= index < offset + limit, after having been ordered according toorder. Each tuple contains a relation and its multiplicity.Parameters: - mclan – The source data. Must be a multiclan.
- less_than_f – A function that accepts two relations as arguments and returns
Trueif the first one is less than the second one. - offset – An atom with an integer value that indicates the index of the first
relation (after sorting the multiclan) in the result. Set to
Atom(0)if you want to start with the first relation of the sorted multiclan. - limit – An atom with an integer value that indicates how many relations should be in
the resulting multiclan. When
limitisfloat('inf'), all relations are returned.
Note
Eventually we may add a
MathObjectrepresentation for sequences (‘ordered sets’). Until we do, we can’t split the application of offset and limit from the ordering/sorting.
-
algebraixlib.algebras.multiclans.order_slice()[source]¶ Return a multiclan that contains the relations with indices
offset <= index < offset + limit, after having been ordered according toorder.Parameters: - mclan – The source data. Must be a multiclan.
- less_than_f – A function that accepts two relations as arguments and returns
Trueif the first one is less than the second one. - offset – An atom with an integer value that indicates the index of the first
relation (after sorting the multiclan) in the result. Set to
Atom(0)if you want to start with the first relation of the sorted multiclan. - limit – An atom with an integer value that indicates how many relations should be in
the resulting multiclan. When
limitisfloat('inf'), all relations are returned.
-
algebraixlib.algebras.multiclans.from_dict()[source]¶ Return a multiclan with a single relation where the couplets are the elements of
dict1.
-
algebraixlib.algebras.multiclans.diag()[source]¶ Return a multiclan diagonal of the arguments.
Parameters: args – Pass in the elements from which the clan diagonal is formed. (If you want to pass in an iterable, you need to prefix it with an asterisk *.)