Skip to content

Commit

Permalink
Minor changes, more todos
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniscirpons committed Dec 6, 2024
1 parent 67268b2 commit e25ca2c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 39 deletions.
14 changes: 3 additions & 11 deletions include/libsemigroups/sims.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

// TODO(0):
// * review the function aliases, and remove them if they are unnecessary
// * doc
// * const
// * noexcept
// * nodiscard
Expand Down Expand Up @@ -514,8 +513,7 @@ namespace libsemigroups {
//! \throws LibsemigroupsException if `p` is not valid.
//!
//! \throws LibsemigroupsException if the alphabet of `p` is non-empty and
//! not equal to that of \ref long_rules or \ref presentation.
// TODO(1) review the previous exception
//! not compatible with \ref include or \ref exclude.
//!
//! \throws LibsemigroupsException if `p` has 0-generators and 0-relations.
template <typename Word>
Expand Down Expand Up @@ -870,8 +868,6 @@ namespace libsemigroups {
//! \warning
//! This function replaces all previously set `exclude` pairs with
//! those found in `[first, last)`.
// TODO(1) maybe should add instead of replacing similar to exclude of r
// pair? Replaces current exclude with [first, last)
template <typename Iterator>
Subclass& exclude(Iterator first, Iterator last) {
add_exclude_pruner();
Expand Down Expand Up @@ -1065,10 +1061,10 @@ namespace libsemigroups {

protected:
using PendingDef = typename Sims1or2::PendingDef;
// TODO(1) (Sims1) ensure that _felsch_graph's settings are
// properly initialised
using Definition = std::pair<node_type, label_type>;

// TODO(1) (Sims1) ensure that _felsch_graph's settings are
// properly initialised
FelschGraph<word_type, node_type, std::vector<Definition>>
_felsch_graph;

Expand Down Expand Up @@ -2177,9 +2173,6 @@ namespace libsemigroups {
WordGraph<Node> const&);

public:
// TODO(0) add noexcept?
// NOTE(RC): Not sure if noexcept, initializing the _tree field of type
// Forest allocates memory
//! Default constructor
const_rcgp_iterator() = default;
//! Default copy constructor.
Expand Down Expand Up @@ -2893,7 +2886,6 @@ namespace libsemigroups {
//! \warning
//! This method does not verify if \p forbid contains trivial pairs or not.
// TODO(2): Construct from std::vector<std::string>
// TODO(2): Template constructor on typename Word
explicit SimsRefinerFaithful(std::vector<word_type> const& forbid)
: _forbid(forbid) {}

Expand Down
9 changes: 7 additions & 2 deletions src/sims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,13 @@ namespace libsemigroups {
that._pending.cend());
}

// TODO(0) expand to longer comment about thread sanitizer warnings and how
// we can gleefully ignore them
// NOTE: (reiniscirpons)
// When running the thread sanitizer we get the error
// ThreadSanitizer: lock-order-inversion (potential deadlock)
// This can be ignored here, despite the lock order inversion, since we only
// every try to steal when we are empty from a non-empty thread, it cannot
// be the case that two threads try to steal from each other simultaneously.
// In other words the thread sanitizer is overly cautious here.
template <typename Sims1or2>
bool SimsBase<Sims1or2>::thread_iterator::try_steal(thread_iterator& that) {
std::lock_guard<std::mutex> lock(iterator_base::_mtx);
Expand Down
27 changes: 1 addition & 26 deletions tests/test-sims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2348,7 +2348,7 @@ namespace libsemigroups {
"[extreme][low-index][plactic]") {
std::array<uint64_t, 8> const num
= {0, 1, 67, 2'794, 106'264, 4'795'980, 278'253'841, 20'855'970'290};
// Last value too 1h34m to compute so is not included.
// Last value took 1h34m to compute so is not included.
auto rg = ReportGuard(true);
auto p = plactic_monoid(4);
p.contains_empty_word(false);
Expand Down Expand Up @@ -4243,9 +4243,6 @@ namespace libsemigroups {
"119",
"2-sided ideals Jura's example",
"[quick][sims1][no-valgrind]") {
// TODO(0) change category back to quick, these fail
// currently because of changes to the api in
// ToddCoxeter
Presentation<std::string> p;
p.alphabet("ab");
p.contains_empty_word(false);
Expand Down Expand Up @@ -4405,9 +4402,6 @@ namespace libsemigroups {
"123",
"Adding and removing pruners",
"[quick][low-index]") {
// TODO(0) change category back to quick, these fail
// currently because of changes to the api in
// ToddCoxeter
auto rg = ReportGuard(true);
Presentation<std::string> p;
p.alphabet("ab");
Expand Down Expand Up @@ -5185,22 +5179,3 @@ namespace libsemigroups {
}

} // namespace libsemigroups

// [[[0, 0, 0]], #1#
// [[0, 0, 1], [1, 0, 1]], #2#
// [[0, 1, 0], [1, 1, 0]],
// [[0, 1, 1], [1, 1, 1]]] #3#

// [[[0, 0, 0]], #1#
// [[1, 0, 1], [1, 1, 1]],
// [[1, 0, 2], [1, 1, 1], [1, 2, 1]],
// [[1, 1, 1], [1, 1, 1]], #2#
// [[1, 1, 2], [1, 1, 1], [1, 1, 1]], #4#
// [[1, 0, 1], [2, 1, 2], [2, 2, 2]],
// [[1, 0, 2], [2, 1, 2], [2, 2, 2]],
// [[1, 1, 2], [2, 1, 2], [2, 2, 2]], #3#
// [[1, 2, 2], [2, 1, 2], [2, 2, 2]],
// [[1, 0, 2], [2, 2, 2], [2, 2, 2]],
// [[1, 2, 1], [2, 2, 2], [2, 2, 2]],
// [[1, 2, 2], [2, 2, 2], [2, 2, 2]],
// [[1, 2, 1], [1, 1, 1], [1, 2, 1]]]

0 comments on commit e25ca2c

Please sign in to comment.