Adapter member types

This page contains information about the adapter member types of the FroidurePin class.

using libsemigroups::FroidurePin::Complexity = typename TTraits::Complexity

Adapter for the complexity of multiplication.

Defined in adapters.hpp.

Specialisations of this struct should be stateless trivially default constructible with a call operator of signature size_t operator()(TElementType const& x) const (possibly noexcept, inline and/or constexpr also).

The return value of the call operator ought to indicate the approximate complexity of multiplying two instances of TElementType, which may or may not depend on the parameter x. This is used, for example, by FroidurePin in some member functions to determine whether it is better to multiply elements or to follow a path in the Cayley graph.

The second template parameter exists for SFINAE.

Used by:

Example

template <>
struct Complexity<KBE> {
  constexpr size_t operator()(KBE const&) const noexcept {
    return LIMIT_MAX;
  }
};

Template Parameters

TElementType – the type of the elements of a semigroup.

using libsemigroups::FroidurePin::Degree = typename TTraits::Degree

Adapter for the degree of an element.

Defined in adapters.hpp.

Specialisations of this struct should be stateless trivially default constructible with a call operator of signature size_t operator()(TElementType const& x) const (possibly noexcept, inline and/or constexpr also).

The return value of the call operator ought to indicate the degree of a TElementType instance which may or may not depend on the parameter x. The degree of a permutation, for instance, would be the the number of points it acts on, the degree of a matrix is its dimension, and so on. This is used, for example, by SchreierSimsTraits in some member functions to determine whether it is known a priori that a permutation does not belong to the object, because it acts on too many points.

Used by:

Example

template <>
struct Degree<BMat8> {
  constexpr inline size_t operator()(BMat8 const&) const noexcept {
    return 8;
  }
};

Template Parameters
  • TElementType – the type of the elements of a semigroup.

  • TSfinae – this template parameter can be used for SFINAE.

using libsemigroups::FroidurePin::EqualTo = typename TTraits::EqualTo

Adapter for testing equality.

Defined in adapters.hpp.

This type should be a stateless trivially default constructible with a call operator of signature bool operator()(TValueType const&, TValueType const&) (possibly noexcept, inline and/or constexpr also) for use with, for example, std::unordered_map.

Used by:

Template Parameters
  • TValueType – the type of objects to compare.

  • TSfinae – this template parameter can be used for SFINAE.

using libsemigroups::FroidurePin::Hash = typename TTraits::Hash

Adapter for hashing.

Defined in adapters.hpp.

This type should be a stateless trivially default constructible with a call operator of signature size_t operator()(TValueType const&) for use with, for example, std::unordered_map.

Used by:

Template Parameters
  • TValueType – the type of objects to compare.

  • TSfinae – this template parameter can be used for SFINAE.

using libsemigroups::FroidurePin::IncreaseDegree = typename TTraits::IncreaseDegree

Adapter for increasing the degree of an element.

Defined in adapters.hpp.

Specialisations of this struct should be stateless trivially default constructible with a call operator of signature void operator()(TElementType& x, size_t n) const (possibly noexcept, inline and/or constexpr also).

The call operator should change the first argument in-place so that if m = Degree<TElementType>()(x), then after the call to IncreaseDegree<TElementType>()(x, n), Degree<TElementType>()(x) returns m + n. This only makes sense for certain types of elements, such as permutations, transformations, or matrices, and not for other types of object. In the latter case, the call operator should simply do nothing. This is used, for example, in the member function FroidurePin::closure, when one of the generators being added has degree larger than the existing generators.

The second template parameter exists for SFINAE.

Used by:

Example

template <typename TIntegralType>
struct IncreaseDegree<
    TIntegralType,
    typename std::enable_if<std::is_integral<TIntegralType>::value>::type>
    {
  void operator()(TIntegralType&, size_t) const noexcept {
  }
};

Template Parameters

TElementType – the type of the elements of a semigroup.

using libsemigroups::FroidurePin::Less = typename TTraits::Less

Adapter for comparisons.

Defined in adapters.hpp.

This type should be a stateless trivially default constructible with a call operator of signature bool operator()(TValueType const&, TValueType const&) (possibly noexcept, inline and/or constexpr also) which defines a linear order on the objects of type TValueType

Used by:

Template Parameters
  • TValueType – the type of objects to compare.

  • TSfinae – this template parameter can be used for SFINAE.

using libsemigroups::FroidurePin::One = typename TTraits::One

Adapter for the identity element of the given type.

Specialisations of this struct should be stateless trivially default constructible with two call operator of signatures:

  1. TElementType operator()(size_t n) const (possibly noexcept, inline and/or constexpr also) returning a multiplicative identity element for the category TElementType and with Degree<TElementType>()(x) equal to the parameter n. For example, if TElementType is a type of n x n matrices, then this should return the n x n identity matrix.

  2. TElementType operator()(T const&) const (possibly noexcept, inline and/or constexpr also). This could be implemented as:

    TElementType operator()(TElementType const& x) const noexcept {
      return this->operator()(Degree<TElementType>()(x));
    }
    

Used by:

Example

template <typename T>
struct One<
    T,
    typename std::enable_if<std::is_base_of<PTransf16, T>::value>::type> {
  T operator()(size_t = 0) const noexcept {
    return T::one();
  }

  T operator()(T const&) const noexcept {
    return T::one();
  }
};

Template Parameters
  • TElementType – the type of the elements of a semigroup.

  • TSfinae – this template parameter can be used for SFINAE.

using libsemigroups::FroidurePin::Product = typename TTraits::Product

Adapter for the product of two elements.

Defined in adapters.hpp.

Specialisations of this struct should be stateless trivially default constructible with a call operator of signature void operator()(TElementType& xy, TElementType const& x, TElementType const& y, size_t = 0) (possibly noexcept, inline and/or constexpr also).

The call operator should change xy in-place to be the product of x and y. The 4th parameter is optional and it can be used as an index for static thread local storage, that might be required for forming the product of x and y. The purpose of the 1st parameter is to avoid repeated allocations of memory to hold temporary products that are discarded soon after they are created.

Used by:

Example

template <>
struct Product<size_t> {
  void operator()(size_t& xy, size_t x, size_t y, size_t = 0) const
  noexcept {
    xy = x * y;
  }
};

Template Parameters
  • TElementType – the type of the elements of a semigroup.

  • TSfinae – this template parameter can be used for SFINAE.

using libsemigroups::FroidurePin::Swap = typename TTraits::Swap

Adapter for swapping.

Defined in adapters.hpp.

This type should be a stateless trivially default constructible with a call operator of signature void operator()(TValueType const&, TValueType const&) (possibly noexcept, inline and/or constexpr also) which swaps its arguments.

Used by:

Template Parameters
  • TValueType – the type of objects to compare.

  • TSfinae – this template parameter can be used for SFINAE.