Fixed memoization module

Implement "raise" (called recontext)
Implement tile
This commit is contained in:
Jacob
2020-01-20 17:47:39 -05:00
parent 214f54fe89
commit e2295687bf
6 changed files with 227 additions and 39 deletions

View File

@@ -1,2 +1,5 @@
add_executable(memo memotest.cpp)
target_link_libraries(memo PRIVATE tc vis-util)
add_executable(geom geomtest.cpp)
target_link_libraries(geom PRIVATE tc vis-util)

40
examples/geomtest.cpp Normal file
View File

@@ -0,0 +1,40 @@
//
// Created by raymo on 1/20/2020.
//
#include <tc/groups.hpp>
#include <geometry.hpp>
#include <iostream>
int main () {
auto g = tc::group::B(3);
GeomGen gg(g);
Simplexes s(1);
s.vals.push_back(0);
s.vals.push_back(1);
s.vals.push_back(0);
s.vals.push_back(2);
s.vals.push_back(1);
s.vals.push_back(2);
auto g_gens = gg.group_gens();
std::vector<int> sg_gens = {1,2};
auto ns = gg.tile(g_gens,sg_gens,s);
std::cout << "Before: " << std::endl;
std::cout << '\t';
for (int val : s.vals) {
std::cout << val << " ";
}
std::cout << std::endl;
std::cout << " After: " << std::endl;
std::cout << '\t';
for (int val : ns.vals) {
std::cout << val << " ";
}
std::cout << std::endl;
return 0;
}

View File

@@ -1,11 +1,11 @@
#include <geometry.hpp>
#include <tc/groups.hpp>
#include <iostream>
#include <ctime>
#include <chrono>
int main() {
tc::Group g = tc::group::B(3);
CosetMemo m(g);
GeomGen m(g);
m.solve({}, {});
m.solve({0}, {});
@@ -36,19 +36,19 @@ int main() {
m.solve({0, 1, 2}, {0, 1, 2});
tc::Group big = tc::group::B(8);
CosetMemo mbig(big);
GeomGen mbig(big);
auto s1 = clock();
m.solve({0, 1, 2, 3, 4, 5, 6, 7}, {});
auto e1 = clock();
auto s1 = std::chrono::system_clock::now();
auto res1 = mbig.solve({0,1,2,3,4,7}, {2,4,7});
auto e1 = std::chrono::system_clock::now();
double t1 = (double) (e1 - s1) / (double) CLOCKS_PER_SEC;
std::cout << t1 << std::endl;
std::chrono::duration<double> t1 = e1 - s1;
std::cout << t1.count() << ": " << res1.size() << std::endl;
auto s2 = clock();
m.solve({0, 1, 2, 3, 4, 5, 6, 7}, {});
auto e2 = clock();
auto s2 = std::chrono::system_clock::now();
auto res2 = mbig.solve({0,2,4,7,1,3}, {4,7,2});
auto e2 = std::chrono::system_clock::now();
double t2 = (double) (e2 - s2) / (double) CLOCKS_PER_SEC;
std::cout << t2 << std::endl;
std::chrono::duration<double> t2 = e2 - s2;
std::cout << t2.count() << ": " << res2.size() << std::endl;
}