group constraint cassert

This commit is contained in:
David Allemang
2022-09-16 13:24:51 -04:00
parent 6d1bb807f3
commit 2ba15097ec
2 changed files with 13 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
#include <sstream> #include <sstream>
#include <tc/pair_map.hpp> #include <tc/pair_map.hpp>
#include <cassert>
namespace tc { namespace tc {
struct Group; struct Group;
@@ -45,9 +46,7 @@ namespace tc {
void set(const Rel &r) { void set(const Rel &r) {
auto &[i, j, m] = r; auto &[i, j, m] = r;
if (i == j && m != 1) { assert(i != j || m == 1);
throw std::runtime_error("Coxeter groups must satisfy m_ii=1.");
}
_mults(i, j) = m; _mults(i, j) = m;
} }

View File

@@ -1,6 +1,6 @@
#include "tc/groups.hpp" #include <cassert>
#include <sstream> #include "tc/groups.hpp"
namespace tc { namespace tc {
Group schlafli(const std::vector<int> &mults) { Group schlafli(const std::vector<int> &mults) {
@@ -13,11 +13,14 @@ namespace tc {
namespace group { namespace group {
Group A(const int dim) { Group A(const int dim) {
if (dim == 0) return Group(0); assert(dim >= 1);
return schlafli(std::vector<int>(dim - 1, 3)); return schlafli(std::vector<int>(dim - 1, 3));
} }
Group B(const int dim) { Group B(const int dim) {
assert(dim >= 2);
std::vector<int> mults(dim - 1, 3); std::vector<int> mults(dim - 1, 3);
mults[0] = 4; mults[0] = 4;
@@ -25,9 +28,7 @@ namespace tc {
} }
Group D(const int dim) { Group D(const int dim) {
if (dim <= 2) { assert(dim >= 4);
throw std::runtime_error("tc::group::D requires dim > 2.");
}
std::vector<int> mults(dim - 1, 3); std::vector<int> mults(dim - 1, 3);
mults[dim - 2] = 2; mults[dim - 2] = 2;
@@ -39,9 +40,7 @@ namespace tc {
} }
Group E(const int dim) { Group E(const int dim) {
if (dim <= 3) { assert(dim >= 6);
throw std::runtime_error("tc::group::E requires dim > 3.");
}
std::vector<int> mults(dim - 1, 3); std::vector<int> mults(dim - 1, 3);
mults[dim - 2] = 2; mults[dim - 2] = 2;
@@ -61,6 +60,9 @@ namespace tc {
} }
Group H(const int dim) { Group H(const int dim) {
assert(dim >= 2);
assert(dim <= 4);
std::vector<int> mults(dim - 1, 3); std::vector<int> mults(dim - 1, 3);
mults[0] = 5; mults[0] = 5;