Skip to content

Commit

Permalink
Add current size
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph-Edwards committed Nov 13, 2024
1 parent 32928cd commit 698ca0f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/libsemigroups/schreier-sims.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ namespace libsemigroups {
// not noexcept because run isn't
[[nodiscard]] uint64_t size();

[[nodiscard]] uint64_t current_size() const;

//! \brief Sift an element through the stabiliser chain in-place.
//!
//! Sift an element through the stabiliser chain in-place.
Expand Down
15 changes: 14 additions & 1 deletion include/libsemigroups/schreier-sims.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ namespace libsemigroups {
return out;
}

template <size_t N, typename Point, typename Element, typename Traits>
uint64_t SchreierSims<N, Point, Element, Traits>::current_size() const {
// TODO(later) check if product overflows?
if (empty()) {
return 1;
}
uint64_t out = 1;
for (index_type i = 0; i < _base_size; i++) {
out *= _orbits.size(i);
}
return out;
}

template <size_t N, typename Point, typename Element, typename Traits>
bool SchreierSims<N, Point, Element, Traits>::currently_contains(
const_element_reference x) const {
Expand Down Expand Up @@ -652,7 +665,7 @@ namespace libsemigroups {
}

if (S.finished()) {
size_t size = const_cast<SchreierSims<N>&>(S).size();
size_t size = S.current_size();

out = fmt::format("<SchreierSims with {} generator{}, base {} & size {}>",
nr_generators,
Expand Down

0 comments on commit 698ca0f

Please sign in to comment.