libsemigroups  v3.0.0
C++ library for semigroups and monoids
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Loading...
Searching...
No Matches
PPerm< N, Scalar >
template<size_t N = 0, typename Scalar = std::conditional_t<N == 0, uint32_t, typename SmallestInteger<N>::type>>
class libsemigroups::PPerm< N, Scalar >

Defined in transf.hpp.

A partial permutation f is just an injective partial transformation, which is stored as a container of the images of {0,1,,n1}, i.e. ((0)f,(1)f,,(n1)f) where the value UNDEFINED is used to indicate that (i)f is undefined (i.e. not among the points where f is defined).

If N is 0 (the default), then the degree of a PPerm instance can be defined at runtime, and if N is not 0, then the degree is fixed at compile time.

If N is 0, then the default value of Scalar is uint32_t. If N is not 0, then the default value of Scalar is the smallest integer type able to hold N. See also SmallestInteger.

Template Parameters
Nthe degree (default: 0).
Scalaran unsigned integer type (the type of the image values) (default: uint32_t).

This class inherits from either StaticPTransf or DynamicPTransf, see the documentation of these classes for more details of the available member functions.

Public Types

using container_type = typename base_type::container_type
 Type of the underlying container.
 
using point_type = Scalar
 Type of the image values.
 

Public Member Functions

 PPerm (std::initializer_list< point_type > dom, std::initializer_list< point_type > img, size_t M)
 Construct from domain, range, and degree.
 
template<typename OtherScalar>
 PPerm (std::vector< OtherScalar > const &dom, std::vector< OtherScalar > const &img, size_t M)
 Construct from domain, range, and degree.
 
void product_inplace (PPerm const &f, PPerm const &g)
 Multiply two partial perms and store the product in this.
 

Static Public Member Functions

static PPerm one (size_t M)
 Returns the identity transformation on the given number of points.
 

Member Typedef Documentation

◆ container_type

template<size_t N = 0, typename Scalar = std::conditional_t<N == 0, uint32_t, typename SmallestInteger<N>::type>>
using container_type = typename base_type::container_type

In this case, this is PTransf<N, Scalar>::container_type.

◆ point_type

template<size_t N = 0, typename Scalar = std::conditional_t<N == 0, uint32_t, typename SmallestInteger<N>::type>>
using point_type = Scalar

Also the template parameter Scalar.

Constructor & Destructor Documentation

◆ PPerm() [1/2]

template<size_t N = 0, typename Scalar = std::conditional_t<N == 0, uint32_t, typename SmallestInteger<N>::type>>
template<typename OtherScalar>
PPerm ( std::vector< OtherScalar > const & dom,
std::vector< OtherScalar > const & img,
size_t M )

Constructs a partial perm of degree M such that f[dom[i]] = img[i] for all i and which is UNDEFINED on every other value in the range [0,M).

Template Parameters
OtherScalarthe type of the points in dom and img.
Parameters
domthe domain.
imgthe range.
Mthe degree.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Linear in the size of dom.
Warning
No checks whatsoever are performed on the validity of the arguments.

◆ PPerm() [2/2]

template<size_t N = 0, typename Scalar = std::conditional_t<N == 0, uint32_t, typename SmallestInteger<N>::type>>
PPerm ( std::initializer_list< point_type > dom,
std::initializer_list< point_type > img,
size_t M )
inline

Constructs a partial perm of degree M such that f[dom[i]] = img[i] for all i and which is UNDEFINED on every other value in the range [0,M).

Template Parameters
OtherScalarthe type of the points in dom and img.
Parameters
domthe domain.
imgthe range.
Mthe degree.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Linear in the size of dom.
Warning
No checks whatsoever are performed on the validity of the arguments.

Member Function Documentation

◆ one()

template<size_t N = 0, typename Scalar = std::conditional_t<N == 0, uint32_t, typename SmallestInteger<N>::type>>
static PPerm one ( size_t M)
inlinestaticnodiscard

This function returns a newly constructed transformation with degree equal to M that fixes every value from 0 to M.

Parameters
Mthe degree.
Returns
A value of type Transf.
Exceptions
LibsemigroupsExceptionif IsStatic<Transf> is true, and M is not the same as the template parameter N.

◆ product_inplace()

template<size_t N = 0, typename Scalar = std::conditional_t<N == 0, uint32_t, typename SmallestInteger<N>::type>>
void product_inplace ( PPerm< N, Scalar > const & f,
PPerm< N, Scalar > const & g )

Replaces the contents of this by the product of f and g.

Parameters
fa partial perm.
ga partial perm.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Linear in degree of f or g.
Warning
No checks are made on whether or not the parameters are compatible. If f and g have different degrees, then bad things will happen.

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