working on memoization

This commit is contained in:
2020-01-08 22:03:35 -05:00
parent cee667d1b3
commit fb33a78718
20 changed files with 186 additions and 762 deletions

View File

@@ -1,33 +0,0 @@
#pragma once
#include "groups.h"
#include <vector>
namespace tc {
struct Action {
int coset = -1;
int gen = -1;
int target = -1;
};
struct Cosets {
int ngens;
std::vector<int> data;
std::vector<Action> path;
int len;
explicit Cosets(int ngens);
void add_row();
void put(int coset, int gen, int target);
void put(int idx, int target);
[[nodiscard]] int get(int coset, int gen) const;
[[nodiscard]] int get(int idx) const;
[[nodiscard]] int size() const;
};
}

View File

@@ -1,96 +0,0 @@
#pragma once
#include <array>
#include <vector>
namespace tc {
struct Rel {
std::array<int, 2> gens;
int mult;
};
/**
* A presentation of a coxeter group. Contains a number of generators and some relations of the form (ab)^n = e
*/
struct Group {
const int ngens;
std::vector<std::vector<int>> _mults; // lookup table for multiplicities
std::string name;
explicit Group(int ngens, const std::vector<Rel> &rels = {}, std::string name = "G");
void setmult(Rel rel);
[[nodiscard]] Rel rel(int a, int b) const;
[[nodiscard]] std::vector<Rel> get_rels() const;
[[nodiscard]] Group product(const Group &other) const;
[[nodiscard]] Group power(int p) const;
[[nodiscard]] bool trivial() const;
};
Group operator*(const Group &g, const Group &h);
Group operator^(const Group &g, const int &p);
/**
* Construct a group from a (simplified) Schlafli Symbol of the form [a, b, ..., c]
* @param mults: The sequence of multiplicites between adjacent generators.
*/
Group schlafli(const std::vector<int> &mults);
namespace group {
/**
* Simplex
*/
Group A(int dim);
/**
* Cube, Orthoplex
*/
Group B(int dim);
/**
* Demicube, Orthoplex
*/
Group D(int dim);
/**
* E groups
*/
Group E(int dim);
/**
* 24 Cell
*/
Group F4();
/**
* Hexagon
*/
Group G2();
/**
* Icosahedron
*/
Group H(int dim);
/**
* Polygonal
*/
Group I2(int n);
/**
* Toroidal. I2(n) * I2(m)
*/
Group T(int n, int m);
/**
* Toroidal. T(n, n)
*/
Group T(int n);
}
}

View File

@@ -1,7 +0,0 @@
#pragma once
#include "cosets.h"
namespace tc {
Cosets solve(const Group &g, const std::vector<int> &sub_gens = {});
}