// // libsemigroups - C++ library for semigroups and monoids // Copyright (C) 2019 James D. Mitchell // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. //
// This file contains implementations of the PBR class.
#include"libsemigroups/pbr.hpp"
#include <algorithm> // for all_of, fill #include <ostream> // for operator<<, cha... #include <string> // for operator+, char... #include <thread> // for thread
#include"libsemigroups/containers.hpp"// for DynamicArray2 #include"libsemigroups/debug.hpp"// for LIBSEMIGROUPS_A... #include"libsemigroups/exception.hpp"// for LIBSEMIGROUPS_E... #include"libsemigroups/string.hpp"// for to_string
if (n != right.size()) {
LIBSEMIGROUPS_EXCEPTION("the two vectors must have the same length");
} if (n > 0x40000000) {
LIBSEMIGROUPS_EXCEPTION("too many points!");
} for (std::vector<int32_t> vec : left) {
v = std::vector<uint32_t>(); for (int32_t x : vec) { if (x == 0 || x < -static_cast<int32_t>(n)
|| x > static_cast<int32_t>(n)) {
LIBSEMIGROUPS_EXCEPTION( "value out of bounds in the 1st argument, expected values in " "[%d, -1] or [1, %d] but found %d",
-n,
n,
x);
} if (x > 0) {
v.push_back(static_cast<uint32_t>(x - 1));
}
} // We have to go backwards through the vector to add the negative // entries, so that users can input those negative entries in the // natural order for (auto it = vec.rbegin(); it < vec.rend(); ++it) { if (*it < 0) {
v.push_back(static_cast<uint32_t>(n - *it - 1));
}
}
out.push_back(v);
} for (std::vector<int32_t> vec : right) {
v = std::vector<uint32_t>(); for (int32_t x : vec) { if (x == 0 || x < -static_cast<int32_t>(n)
|| x > static_cast<int32_t>(n)) {
LIBSEMIGROUPS_EXCEPTION( "value out of bounds in the 1st argument, expected values in " "[%d, -1] or [1, %d] but found %d",
-n,
n,
x);
} if (x > 0) {
v.push_back(static_cast<uint32_t>(x - 1));
}
} for (auto it = vec.rbegin(); it < vec.rend(); ++it) { if (*it < 0) {
v.push_back(static_cast<uint32_t>(n - *it - 1));
}
}
out.push_back(v);
} return out;
}
void unite_rows(detail::DynamicArray2<bool>& out,
detail::DynamicArray2<bool>& tmp,
size_t const& i,
size_t const& j) { for (size_t k = 0; k < out.number_of_cols(); k++) {
out.set(i, k, (out.get(i, k) || tmp.get(j, k + 1)));
}
}
void validate(PBR const& x) {
size_t n = x._vector.size(); if (n % 2 == 1) {
LIBSEMIGROUPS_EXCEPTION("expected argument of even length");
} for (size_t u = 0; u < n; ++u) { for (autoconst& v : x._vector.at(u)) { if (v >= n) {
LIBSEMIGROUPS_EXCEPTION( "entry out of bounds, vertex " + detail::to_string(u)
+ " is adjacent to " + detail::to_string(v)
+ ", should be less than " + detail::to_string(n));
}
}
} for (size_t u = 0; u < n; ++u) { if (!std::is_sorted(x._vector.at(u).cbegin(), x._vector.at(u).cend())) {
LIBSEMIGROUPS_EXCEPTION("the adjacencies of vertex ",
detail::to_string(u).c_str(), " are unsorted");
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.