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:
object
Provide 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()
ifmulticlan
is not a multiclan.
-
static
compose
()[source]¶ Return the composition of
multiclan1
withmulticlan2
.Returns: The binary multi-extension of composition from the algebra of relations to the algebra of multiclans, applied to multiclan1
andmulticlan2
, orUndef()
ifmulticlan1
ormulticlan2
are not multiclans.
-
static
cross_union
()[source]¶ Return the cross-union of
mclan1
andmclan2
.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 mclan1
andmclan2
, orUndef()
ifmclan1
ormclan2
are not multiclans.
-
static
cross_functional_union
()[source]¶ Return the cross-functional union of
mclan1
andmclan2
.Returns: The binary multi-extension of the functional union from the algebra of relations to the algebra of multiclans, applied to mclan1
andmclan2
, orUndef()
ifmclan1
ormclan2
are not multiclans.
-
static
cross_right_functional_union
()[source]¶ Return the cross-right-functional union of
multiclan1
andmulticlan2
.Returns: The binary multi-extension of the right-functional union from the algebra of relations to the algebra of multiclans, applied to multiclan1
andmulticlan2
, orUndef()
ifmulticlan1
ormulticlan2
are not multiclans.
-
static
cross_intersect
()[source]¶ Return the cross-intersection of
multiclan1
andmulticlan2
.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 multiclan1
andmulticlan2
, orUndef()
ifmulticlan1
ormulticlan2
are not multiclans.
-
static
substrict
()[source]¶ Return the substriction of
multiclan1
andmulticlan2
.The substriction of two multiclans is a multiclan that contains all relations from
multiclan1
that 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 multiclan1
andmulticlan2
, orUndef()
ifmulticlan1
ormulticlan2
are not multiclans.
-
static
superstrict
()[source]¶ Return the superstriction of
multiclan1
andmulticlan2
.The superstriction of two multiclans is a multiclan that contains all relations from
multiclan1
that 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 multiclan1
andmulticlan2
, orUndef()
ifmulticlan1
ormulticlan2
are 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
obj
is a member of the ground set of this algebra.return: True
ifobj
is a multiclan,False
if 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
obj
is either a member of the ground set of this algebra - or
Undef
.
Returns: True
ifobj
is either a relation orUndef
,False
if not.- Return whether
-
algebraixlib.algebras.multiclans.
is_absolute_member
(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return whether
obj
is a member of the absolute ground set of this algebra.return: True
ifobj
is an absolute clan,False
if 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 mclan
orUndef()
ifmclan
is 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 mclan
orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
get_rights_for_left
()[source]¶ Return the multiset of the right components of all couplets in the multiclan
mclan
associated with the left componentleft
.Returns: The right multiset of the multiclan mclan
associated with the left componentleft
orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
is_functional
(mclan, _checked=True) → bool[source]¶ Return whether
mclan
is functional.Returns: True
if every relation inmclan
is functional (is a function),False
if not, orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
is_right_functional
(mclan, _checked=True) → bool[source]¶ Return whether
mclan
is right-functional.Returns: True
if every relation inmclan
is right-functional,False
if not, orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
is_regular
(mclan, _checked=True) → bool[source]¶ Return whether
mclan
is (left-)regular.Returns: True
ifmclan
is regular,False
if not, orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
is_right_regular
(mclan, _checked=True) → bool[source]¶ Return whether
mclan
is right-regular.Returns: True
ifmclan
is right-regular,False
if not, orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
is_reflexive
(mclan, _checked=True) → bool[source]¶ Return whether
mclan
is reflexive.Returns: True
ifmclan
is reflexive,False
if it is not, orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
is_symmetric
(mclan, _checked=True) → bool[source]¶ Return whether
mclan
is symmetric.Returns: True
ifmclan
is symmetric,False
if it is not, orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
is_transitive
(mclan, _checked=True) → bool[source]¶ Return whether
mclan
is transitive.Returns: True
ifmclan
is transitive,False
if it is not, orUndef()
ifmclan
is not a multiclan.
-
algebraixlib.algebras.multiclans.
project
()[source]¶ Return a multiclan that contains only the couplets with lefts from
mclan
that 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()
ifmclan
is 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 usingoffset
orlimit
. (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
limit
isfloat('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
True
if 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
limit
isfloat('inf')
, all relations are returned.
Note
Eventually we may add a
MathObject
representation 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
True
if 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
limit
isfloat('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 *
.)