21#ifndef LIBSEMIGROUPS_PBR_HPP_
22#define LIBSEMIGROUPS_PBR_HPP_
26#include <initializer_list>
33#include "adapters.hpp"
214 size_t thread_id = 0);
255 bool operator==(
PBR const& that)
const {
256 return _vector == that._vector;
274 return _vector < that._vector;
527 template <
typename Return,
typename... T>
568 template <
typename Return>
577 template <
typename Return>
607 template <
typename Return>
687 return x < y || x == y;
703 template <
typename T>
717 template <
typename T>
718 static constexpr bool IsPBR = detail::IsPBRHelper<T>::value;
756 return 8 * x.degree() * x.degree() * x.degree();
Class for representing PBRs.
Definition pbr.hpp:62
enable_if_is_same< Return, PBR > make(T... args)
Construct and check a PBR.
Definition pbr.hpp:528
friend std::ostringstream & operator<<(std::ostringstream &, PBR const &)
Insertion operator.
PBR(PBR &&)=default
Default move constructor.
void product_inplace(PBR const &x, PBR const &y, size_t thread_id=0)
Multiply two PBR objects and store the product in this.
PBR & operator=(PBR &&)=default
Default move assignment operator.
size_t number_of_points() const noexcept
Returns the number of points of a PBR.
bool operator>=(PBR const &x, PBR const &y)
Convenience function that just calls operator<=.
Definition pbr.hpp:697
std::vector< uint32_t > & operator[](size_t i)
Returns a reference to the points adjacent to a given point.
Definition pbr.hpp:290
bool operator>(PBR const &x, PBR const &y)
Convenience function that just calls operator<.
Definition pbr.hpp:675
size_t degree() const noexcept
Returns the degree of a PBR.
std::vector< uint32_t > const & operator[](size_t i) const
Returns a const reference to the points adjacent to a given point.
Definition pbr.hpp:308
PBR(vector_type< int32_t > left, vector_type< int32_t > right)
Construct from adjacencies 1 to n and -1 to -n.
std::vector< std::vector< T > > const & vector_type
Type of constructor argument.
Definition pbr.hpp:68
bool operator<=(PBR const &x, PBR const &y)
Convenience function that just calls operator< and operator==.
Definition pbr.hpp:686
PBR(initializer_list_type< int32_t > left, initializer_list_type< int32_t > right)
Construct from adjacencies 1 to n and -1 to -n.
std::string to_human_readable_repr(PBR const &x)
Return a human readable representation of a PBR.
PBR operator*(PBR const &x, PBR const &y)
Multiply two PBRs.
void product_inplace_no_checks(PBR const &x, PBR const &y, size_t thread_id=0)
Multiply two PBR objects and store the product in this.
friend std::ostream & operator<<(std::ostream &, PBR const &)
Insertion operator.
PBR(initializer_list_type< uint32_t > x)
Construct from adjacencies 0 to 2n - 1.
size_t hash_value() const
Returns a hash value for a PBR.
Definition pbr.hpp:360
std::vector< uint32_t > const & at(size_t i) const
Returns a const reference to the points adjacent to a given point, with bounds checking.
PBR(PBR const &)=default
Default copy constructor.
bool operator!=(PBR const &x, PBR const &y)
Compare two PBRs for inequality.
Definition pbr.hpp:665
PBR(size_t n)
Construct empty PBR of given degree.
bool operator<(PBR const &that) const
Compare for less.
Definition pbr.hpp:273
std::vector< uint32_t > & at(size_t i)
Returns a reference to the points adjacent to a given point, with bounds checking.
PBR(vector_type< uint32_t > x)
Construct from adjacencies 0 to 2n - 1.
PBR & operator=(PBR const &)=default
Default copy assignment operator.
std::initializer_list< std::vector< T > > const & initializer_list_type
Type of constructor argument.
Definition pbr.hpp:74
@ right
Definition action.hpp:95
@ left
Definition action.hpp:92
enable_if_is_same< Return, Blocks > make(Container const &cont)
Check the arguments, construct a Blocks object, and check it.
Definition bipart.hpp:798
std::enable_if_t< std::is_same_v< Given, Expected >, Expected > enable_if_is_same
Alias equal to the second template parameter if both template parameters are equal.
Definition types.hpp:50
Namespace for PBR helper functions.
Definition pbr.hpp:383
void throw_if_invalid(PBR const &x)
Throws if a PBR is invalid.
Definition pbr.hpp:487
PBR one(size_t n)
Returns the identity PBR with specified degree.
void throw_if_adjacencies_unsorted(PBR const &x)
Throws if a PBR has a list of points related to a point that is not sorted.
void throw_if_entry_out_of_bounds(PBR const &x)
Throws if a PBR has a point related to a point that is greater than degree().
void throw_if_not_even_length(PBR const &x)
Throws if a PBR has an odd number of points.
Namespace for everything in the libsemigroups library.
Definition action.hpp:44
static constexpr bool IsPBR
Helper variable template.
Definition pbr.hpp:718
size_t operator()(PBR const &x) const noexcept
Returns the approximate time complexity of multiplying PBRs.
Definition pbr.hpp:755
Adapter for the complexity of multiplication.
Definition adapters.hpp:121
size_t operator()(PBR const &x) const noexcept
Returns the degree of x.
Definition pbr.hpp:785
Adapter for the degree of an element.
Definition adapters.hpp:159
size_t operator()(PBR const &x) const
Returns a hash value for x.
Definition pbr.hpp:815
Adapter for hashing.
Definition adapters.hpp:446
void operator()(PBR &, size_t)
Do nothing.
Definition pbr.hpp:914
Adapter for increasing the degree of an element.
Definition adapters.hpp:199
PBR operator()(PBR const &x) const
Returns the identity PBR with degree x.degree().
Definition pbr.hpp:843
PBR operator()(size_t N=0) const
Returns the identity PBR with specified degree.
Definition pbr.hpp:864
Adapter for the identity element of the given type.
Definition adapters.hpp:246
void operator()(PBR &xy, PBR const &x, PBR const &y, size_t thread_id=0)
Multiply two PBR objects and store the product in a third.
Definition pbr.hpp:900
Adapter for the product of two elements.
Definition adapters.hpp:284