Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/forest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ Constructs a forest with *n* nodes, that is initialised so that the
parents,
std::vector<int_or_unsigned_constant<node_type>> const&
labels) {
using node_type = node_type;
return make<Forest>(to_ints<node_type>(parents),
to_ints<node_type>(labels));
}),
Expand Down Expand Up @@ -156,10 +155,7 @@ the same state as if it had just been constructed as ``Forest(n)``.
"label",
[](Forest const& self,
node_type i) -> int_or_unsigned_constant<node_type> {
if (self.label(i) != UNDEFINED) {
return {self.label(i)};
}
return {UNDEFINED};
return from_int(self.label(i));
},
py::arg("i"),
R"pbdoc(
Expand Down
2 changes: 1 addition & 1 deletion src/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace libsemigroups {
int_or_unsigned_constant<Int>>;

template <typename Int>
Int to_int(int_or_constant<Int> val) {
Int to_int(int_or_constant<Int> const& val) {
if (std::holds_alternative<Int>(val)) {
return std::get<0>(val);
} else if (std::holds_alternative<Undefined>(val)) {
Expand Down
5 changes: 5 additions & 0 deletions src/transf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ the image of the point ``i`` under the {0} is ``imgs[i]``.
// work.
try {
auto result = a.at(b);
// Don't use from_int here, because that will incorrectly convert
// things to LIMIT_MAX and POSITIVE_INFINITY.
if (result != UNDEFINED) {
return {result};
}
Expand Down Expand Up @@ -170,6 +172,9 @@ definition, which is equal to the size of :any:`{0}.images`.
[](PTransfSubclass& self) {
auto r = rx::iterator_range(self.begin(), self.end())
| rx::transform(
// Don't use from_int here, because that will
// incorrectly convert things to LIMIT_MAX and
// POSITIVE_INFINITY.
[](auto val) -> int_or_unsigned_constant<Scalar> {
if (val != UNDEFINED) {
return {val};
Expand Down
Loading