From 19f551ea9214b101228dedabeee1e2f6e8e2f2ae Mon Sep 17 00:00:00 2001 From: David Allemang Date: Wed, 13 Nov 2019 17:15:25 -0500 Subject: [PATCH] initial --- .gitignore | 51 ++++++++++++++++++++++ CMakeLists.txt | 6 +++ cmake-build-debug/hpc.cbp | 90 +++++++++++++++++++++++++++++++++++++++ main.cpp | 67 +++++++++++++++++++++++++++++ 4 files changed, 214 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 cmake-build-debug/hpc.cbp create mode 100644 main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..30bc57f --- /dev/null +++ b/.gitignore @@ -0,0 +1,51 @@ +.idea/ +*.iml + +# Created by .ignore support plugin (hsz.mobi) +### CMake template +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +### C++ template +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..21cba0a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.14) +project(hpc) + +set(CMAKE_CXX_STANDARD 17) + +add_executable(hpc main.cpp) diff --git a/cmake-build-debug/hpc.cbp b/cmake-build-debug/hpc.cbp new file mode 100644 index 0000000..25035cc --- /dev/null +++ b/cmake-build-debug/hpc.cbp @@ -0,0 +1,90 @@ + + + + + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..c11843c --- /dev/null +++ b/main.cpp @@ -0,0 +1,67 @@ +#include +#include + +using Gens=std::vector; +using Table=std::vector; + +void pp(const Gens &g) { + for (const auto &e : g) { + std::cout << e << " "; + } + std::cout << std::endl; +} + +void pp(const Table &t) { + std::cout << "| table:" << std::endl; + for (const auto &g : t) { + std::cout << "| "; + pp(g); + } +} + +void new_coset(const int ngens, const std::vector &rels, + Table &cosets, std::vector &reltables, + Table &starts, Table &ends) { + + int C = cosets.size(); + + cosets.emplace_back(ngens, -1); + + for (size_t i = 0; i < rels.size(); ++i) { + auto &table = reltables[i]; + + unsigned int R = rels[i].size(); + + table.emplace_back(R + 1, -1); + table[C][0] = C; + table[C][R] = C; + + starts[i].push_back(0); + ends[i].push_back(R); + } +} + +Table solve_tc(int ngens, const Gens &sub, const std::vector &rels) { + Table cosets; + std::vector
reltables(rels.size()); + + // storing progress for each relation table row + Table starts(rels.size()); // [rel_table][coset] + Table ends(rels.size()); + + new_coset(ngens, rels, cosets, reltables, starts, ends); + + return cosets; +} + +int main() { + auto cosets = solve_tc(3, {0, 1}, { + {0, 1, 0, 1, 0, 1, 0, 1}, + {1, 2, 1, 2, 1, 2}, + {0, 2, 0, 2}, + }); + + pp(cosets); + + return 0; +}