![]() |
libsemigroups
v3.0.0
C++ library for semigroups and monoids
|
Defined in transf.hpp
.
This page contains the documentation for functionality in libsemigroups
for various partial transformations.
A partial transformation \(f\) is just a function defined on a subset of \(\{0, 1, \ldots, n - 1\}\) for some integer \(n\) called the degree of f. A partial transformation is stored as a container of the images of \(\{0, 1, \ldots, n -1\}\), i.e. \(((0)f, (1)f, \ldots, (n - 1)f)\) where the value UNDEFINED is used to indicate that \((i)f\) is, you guessed it, undefined (i.e. not among the points where \(f\) is defined).
Topics | |
make<Transf> | |
Safely construct a Transf instance. | |
make<PPerm> | |
Safely construct a PPerm instance. | |
make<Perm> | |
Safely construct a Perm instance. | |
Classes | |
class | DynamicPTransf< Scalar > |
Partial transformations with dynamic degree. More... | |
class | Perm< N, Scalar > |
Permutations with static or dynamic degree. More... | |
class | PPerm< N, Scalar > |
Partial permutations with static or dynamic degree. More... | |
class | PTransfBase< Scalar, Container > |
Base class for partial transformations. More... | |
class | StaticPTransf< N, Scalar > |
Partial transformations with static degree. More... | |
class | Transf< N, Scalar > |
Transformations with static or dynamic degree. More... | |
Typedefs | |
template<size_t N> | |
using | LeastPerm = typename detail::LeastPermHelper<N>::type |
Type of perms using the least memory for a given degree. | |
template<size_t N> | |
using | LeastPPerm = typename detail::LeastPPermHelper<N>::type |
Type of partial perms using the least memory for a given degree. | |
template<size_t N> | |
using | LeastTransf = typename detail::LeastTransfHelper<N>::type |
Type of transformations using the least memory for a given degree. | |
template<size_t N = 0, typename Scalar = std::conditional_t<N == 0, uint32_t, typename SmallestInteger<N>::type>> | |
using | PTransf |
Partial transformations with static or dynamic degree. | |
Functions | |
template<typename T> | |
std::vector< typename T::point_type > | domain (T const &f) |
Returns the set of points where a partial transformation is defined. | |
template<typename T, typename Scalar> | |
void | domain (T const &f, std::vector< Scalar > &dom) |
Replace the contents of a vector by the set of points where a partial transformation is defined. | |
template<typename T> | |
std::vector< typename T::point_type > | image (T const &f) |
Returns the set of images of a partial transformation. | |
template<typename T, typename Scalar> | |
void | image (T const &f, std::vector< Scalar > &im) |
Replace the contents of a vector by the set of images of a partial transformation. | |
template<size_t N, typename Scalar> | |
Perm< N, Scalar > | inverse (Perm< N, Scalar > const &f) |
Returns the inverse of a permutation. | |
template<size_t N, typename Scalar> | |
void | inverse (Perm< N, Scalar > const &from, Perm< N, Scalar > &to) |
Returns the inverse of a permutation. | |
template<size_t N, typename Scalar> | |
PPerm< N, Scalar > | inverse (PPerm< N, Scalar > const &f) |
Returns the inverse of a partial perm. | |
template<size_t N, typename Scalar> | |
void | inverse (PPerm< N, Scalar > const &from, PPerm< N, Scalar > &to) |
Replace contents of a partial perm with the inverse of another. | |
template<size_t N, typename Scalar> | |
PPerm< N, Scalar > | left_one (PPerm< N, Scalar > const &f) |
Returns the left one of a partial perm. | |
template<typename T> | |
auto | one (T const &f) -> std::enable_if_t< IsDerivedFromPTransf< T >, T > |
Returns the identity transformation of same degree as a sample. | |
template<size_t N, typename Scalar> | |
PPerm< N, Scalar > | right_one (PPerm< N, Scalar > const &f) |
Returns the right one of a partial perm. | |
template<typename Scalar, typename Container> | |
void | throw_if_image_value_out_of_range (PTransfBase< Scalar, Container > const &f) |
Check a partial transformation. | |
template<size_t N, typename Scalar> | |
void | throw_if_image_value_out_of_range (Transf< N, Scalar > const &f) |
Check a transformation. | |
template<size_t N, typename Scalar> | |
auto | throw_if_not_perm (Perm< N, Scalar > const &f) |
Check a permutation. | |
template<size_t N, typename Scalar> | |
void | throw_if_not_pperm (PPerm< N, Scalar > const &f) |
Check a partial perm. | |
Variables | |
template<typename T> | |
static constexpr bool | IsDerivedFromPTransf = std::is_base_of_v<detail::PTransfPolymorphicBase, T> |
Helper variable template. | |
template<typename T> | |
static constexpr bool | IsDynamic = detail::IsDynamicHelper<T>::value |
Helper variable template. | |
template<typename T> | |
static constexpr bool | IsPerm = detail::IsPermHelper<T>::value |
Helper variable template. | |
template<typename T> | |
static constexpr bool | IsPPerm = detail::IsPPermHelper<T>::value |
Helper variable template. | |
template<typename T> | |
static constexpr bool | IsPTransf = detail::IsPTransfHelper<T>::value |
Helper variable template. | |
template<typename T> | |
static constexpr bool | IsStatic = detail::IsStaticHelper<T>::value |
Helper variable template. | |
template<typename T> | |
static constexpr bool | IsTransf = detail::IsTransfHelper<T>::value |
Helper variable template. | |
using LeastPerm = typename detail::LeastPermHelper<N>::type |
Helper for getting the type of the least size, and fastest, permutation in libsemigroups
or HPCombi
that are defined on at most N
points.
Defined in transf.hpp
.
N | the maximum number of points the permutations will be defined on. |
using LeastPPerm = typename detail::LeastPPermHelper<N>::type |
Helper for getting the type of the least size, and fastest, partial perm in libsemigroups
or HPCombi
that are defined on at most N
points.
Defined in transf.hpp
.
N | the maximum number of points the partial perms will be defined on. |
using LeastTransf = typename detail::LeastTransfHelper<N>::type |
Helper for getting the type of the least size, and fastest, transformation in libsemigroups
or HPCombi
that are defined on at most N
points.
Defined in transf.hpp
.
N | the maximum number of points the transformations will be defined on. |
using PTransf |
Defined in transf.hpp
.
This alias equals either DynamicPTransf or StaticPTransf depending on the template parameters N
and Scalar
.
If N
is 0
(the default), then PTransf
is DynamicPTransf. In this case the default value of Scalar
is uint32_t
. If N
is not 0
, then PTransf
is StaticPTransf, and the default value of Scalar
is the smallest integer type able to hold N
. See also SmallestInteger.
N | the degree (default: 0 ). |
Scalar | an unsigned integer type (the type of the image values). |
|
nodiscard |
Returns a std::vector containing those values i
such that:
f
; andf[i] != UNDEFINED
.T | the type of the 1st argument (Transf, libsemigroups::PTransf, PPerm, or Perm). |
f | the partial transformation whose image is sought. |
f
.void domain | ( | T const & | f, |
std::vector< Scalar > & | dom ) |
Replaces the contents of the 2nd argument dom
by those values i
such that:
f
; andf[i] != UNDEFINED
.T | the type of the 1st argument (Transf, libsemigroups::PTransf, PPerm, or Perm). |
Scalar | the type of the values in the 2nd argument (typically T::point_type where T is the 1st template parameter). |
f | the partial transformation whose image is sought. |
dom | vector to store the result. |
f
.
|
nodiscard |
Returns a std::vector containing those values f[i]
such that:
f
; andf[i] != UNDEFINED
.T | the type of the 1st argument (Transf, libsemigroups::PTransf, PPerm, or Perm). |
f | the partial transformation whose image is sought. |
f
.void image | ( | T const & | f, |
std::vector< Scalar > & | im ) |
Replaces the contents of the 2nd argument im
by those values f[i]
where:
f
;f[i] != UNDEFINED
.T | the type of the 1st argument (Transf, libsemigroups::PTransf, PPerm, or Perm). |
Scalar | the type of the values in the 2nd argument (typically T::point_type where T is the 1st template parameter. |
f | the partial transformation whose image is sought. |
im | vector to store the result. |
f
.
|
nodiscard |
This function returns a newly constructed inverse of f
. The inverse of a permutation \(f\) is the permutation \(g\) such that \(fg =
gf\) is the identity permutation of degree \(N\).
N | the degree of f . |
Scalar | the type of points of f . |
f | the permutation to invert. |
PPerm
.f.degree()
. void inverse | ( | Perm< N, Scalar > const & | from, |
Perm< N, Scalar > & | to ) |
This function inverts from
into to
. The inverse of a permutation \(f\) is the permutation \(g\) such that \(fg = gf\) is the identity permutation of degree \(n\).
N | the degree of f . |
Scalar | the type of points of f . |
from | the permutation to invert. |
to | the permutation to hold the inverse of from . |
f.degree()
.
|
nodiscard |
This function returns a newly constructed inverse of f
. The inverse of a partial permutation \(f\) is the partial perm \(g\) such that \(fgf = f\) and \(gfg = g\).
N | the degree of f . |
Scalar | the type of points. |
f | the partial perm to invert. |
PPerm
.f.degree()
.void inverse | ( | PPerm< N, Scalar > const & | from, |
PPerm< N, Scalar > & | to ) |
This function inverts from
into to
. The inverse of a partial permutation \(f\) is the partial perm \(g\) such that \(fgf = f\) and \(gfg = g\).
from | the partial perm to invert. |
to | the partial perm to hold the inverse of from . |
f.degree()
.
|
nodiscard |
This function returns a newly constructed partial perm with degree equal to N
that fixes every value in the domain of f
, and is UNDEFINED on any other values.
f | the partial perm. |
f.degree()
.
|
nodiscard |
This function returns a newly constructed partial transformation with degree equal to the degree of f
that fixes every value from 0
to f.degree() - 1
.
T | the type of the transformation being constructed (Perm, PPerm, Transf, or PTransf). |
T
.f.degree()
.
|
nodiscard |
This function returns a newly constructed partial perm with degree equal to N
that fixes every value in the image of the argument f
, and is UNDEFINED on any other values.
f | the partial perm. |
f.degree()
. void throw_if_image_value_out_of_range | ( | PTransfBase< Scalar, Container > const & | f | ) |
N | the degree. |
Scalar | an unsigned integer type (the type of the image values). |
f | the partial transformation to check. |
LibsemigroupsException | if any of the following hold:
|
void throw_if_image_value_out_of_range | ( | Transf< N, Scalar > const & | f | ) |
N | the number of points. |
Scalar | the type of the points. |
f | the transformation. |
LibsemigroupsException | if the image of any point exceeds f.degree() or is equal to UNDEFINED. |
f.degree()
. auto throw_if_not_perm | ( | Perm< N, Scalar > const & | f | ) |
N | the first template parameter of Perm. |
Scalar | the second template parameter of Perm. |
f | the permutation. |
LibsemigroupsException | if:
|
f.degree()
. void throw_if_not_pperm | ( | PPerm< N, Scalar > const & | f | ) |
T | the type of the partial perm to check. |
f | the partial perm. |
LibsemigroupsException | if:
|
f.degree()
.
|
staticconstexpr |
The value of this variable is true
if the template parameter T
is derived from PTransfPolymorphicBase.
T | a type. |
|
staticconstexpr |
The value of this variable is true
if the template parameter T
is derived from DynamicPTransf.
T | a type. |
|
staticconstexpr |
The value of this variable is true
if the template parameter T
is Perm for any template parameters.
T | a type. |
|
staticconstexpr |
The value of this variable is true
if the template parameter T
is PPerm for any template parameters.
T | a type. |
|
staticconstexpr |
The value of this variable is true
if the template parameter T
is either DynamicPTransf or StaticPTransf for any template parameters.
T | a type. |
|
staticconstexpr |
The value of this variable is true
if the template parameter T
is derived from StaticPTransf.
T | a type. |
|
staticconstexpr |
The value of this variable is true
if the template parameter T
is Transf for any template parameters.
T | a type. |