From 2ba15097ecb15a0f6b6cbe45055e62ebafbfb55c Mon Sep 17 00:00:00 2001 From: David Allemang Date: Fri, 16 Sep 2022 13:24:51 -0400 Subject: [PATCH] group constraint cassert --- tc/include/tc/group.hpp | 5 ++--- tc/src/groups.cpp | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tc/include/tc/group.hpp b/tc/include/tc/group.hpp index a850e41..49111cf 100644 --- a/tc/include/tc/group.hpp +++ b/tc/include/tc/group.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace tc { struct Group; @@ -45,9 +46,7 @@ namespace tc { void set(const Rel &r) { auto &[i, j, m] = r; - if (i == j && m != 1) { - throw std::runtime_error("Coxeter groups must satisfy m_ii=1."); - } + assert(i != j || m == 1); _mults(i, j) = m; } diff --git a/tc/src/groups.cpp b/tc/src/groups.cpp index 5004f4e..30b47d2 100644 --- a/tc/src/groups.cpp +++ b/tc/src/groups.cpp @@ -1,6 +1,6 @@ -#include "tc/groups.hpp" +#include -#include +#include "tc/groups.hpp" namespace tc { Group schlafli(const std::vector &mults) { @@ -13,11 +13,14 @@ namespace tc { namespace group { Group A(const int dim) { - if (dim == 0) return Group(0); + assert(dim >= 1); + return schlafli(std::vector(dim - 1, 3)); } Group B(const int dim) { + assert(dim >= 2); + std::vector mults(dim - 1, 3); mults[0] = 4; @@ -25,9 +28,7 @@ namespace tc { } Group D(const int dim) { - if (dim <= 2) { - throw std::runtime_error("tc::group::D requires dim > 2."); - } + assert(dim >= 4); std::vector mults(dim - 1, 3); mults[dim - 2] = 2; @@ -39,9 +40,7 @@ namespace tc { } Group E(const int dim) { - if (dim <= 3) { - throw std::runtime_error("tc::group::E requires dim > 3."); - } + assert(dim >= 6); std::vector mults(dim - 1, 3); mults[dim - 2] = 2; @@ -61,6 +60,9 @@ namespace tc { } Group H(const int dim) { + assert(dim >= 2); + assert(dim <= 4); + std::vector mults(dim - 1, 3); mults[0] = 5;