Skip to content

Commit

Permalink
Optimise Konieczny (libsemigroups#491)
Browse files Browse the repository at this point in the history
* return early from is_group_index

* Format with clang-format v15

---------

Co-authored-by: Finn Smith <[email protected]>
Co-authored-by: James D. Mitchell <[email protected]>
  • Loading branch information
3 people authored Jan 14, 2024
1 parent 8e10e35 commit e0d041b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions include/libsemigroups/containers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,11 @@ namespace libsemigroups {
&& std::equal(cbegin(), cend(), that.cbegin());
}

// not noexcept because == is not
bool operator!=(StaticVector1 const& that) const {
return !(*this == that);
}

void clear() noexcept {
_size = 0;
}
Expand Down
10 changes: 7 additions & 3 deletions include/libsemigroups/konieczny.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1411,12 +1411,16 @@ namespace libsemigroups {
this->to_external_const(y),
this->to_external_const(x));
Lambda()(_tmp_lambda_value1, this->to_external(tmp));
Rho()(_tmp_rho_value1, this->to_external(tmp));
Lambda()(_tmp_lambda_value2, this->to_external_const(x));

if (_tmp_lambda_value1 != _tmp_lambda_value2) {
return false;
}

Rho()(_tmp_rho_value1, this->to_external(tmp));
Rho()(_tmp_rho_value2, this->to_external_const(y));

return _tmp_lambda_value1 == _tmp_lambda_value2
&& _tmp_rho_value1 == _tmp_rho_value2;
return _tmp_rho_value1 == _tmp_rho_value2;
}

// pass full_check = true to use the contains method of the D-classes
Expand Down

0 comments on commit e0d041b

Please sign in to comment.