calculate inverses

This commit is contained in:
Florian Stecker 2018-01-19 12:25:01 +01:00
parent b144b77206
commit 386387569b
5 changed files with 21 additions and 10 deletions

View File

@ -1,8 +1,8 @@
HEADERS=triangle.h linalg.h queue.h HEADERS=triangle.h linalg.h queue.h
#SPECIAL_OPTIONS=-O0 -g -D_DEBUG SPECIAL_OPTIONS=-O0 -g -D_DEBUG
#SPECIAL_OPTIONS=-O3 -pg -funroll-loops -fno-inline #SPECIAL_OPTIONS=-O3 -pg -funroll-loops -fno-inline
SPECIAL_OPTIONS=-O3 -flto -funroll-loops -Winline #SPECIAL_OPTIONS=-O3 -flto -funroll-loops -Winline
#SPECIAL_OPTIONS= #SPECIAL_OPTIONS=
OPTIONS=-m64 -march=native -mtune=native -std=gnu99 -D_GNU_SOURCE $(SPECIAL_OPTIONS) OPTIONS=-m64 -march=native -mtune=native -std=gnu99 -D_GNU_SOURCE $(SPECIAL_OPTIONS)

2
main.c
View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
// the real action // the real action
generate_triangle_group(group, MAX_ELEMENTS, 5, 9, 7); generate_triangle_group(group, MAX_ELEMENTS, 5, 9, 7);
// initialize_triangle_generators(gen, 1.0/5, 1.0/5, 1.0/5, 1.0); // Fuchsian // initialize_triangle_generators(gen, 1.0/5, 1.0/5, 1.0/5, 1.0); // Fuchsian
initialize_triangle_generators(gen, 3.0/5.0, 5.0/9.0, 3.0/7.0, atof(argv[1])); initialize_triangle_generators(gen, 3.0/5.0, 3.0/5.0, 3.0/5.0, atof(argv[1]));
gsl_matrix_set_identity(matrices[0]); gsl_matrix_set_identity(matrices[0]);
for(int i = 1; i < MAX_ELEMENTS; i++) for(int i = 1; i < MAX_ELEMENTS; i++)

View File

@ -23,7 +23,7 @@ int generate_triangle_group(groupelement_t *group, int size, int k1, int k2, int
{ {
queue_t q; queue_t q;
int id, n; int id, n;
groupelement_t *cur; groupelement_t *cur, *inv;
int k[3] = {k1, k2, k3}; int k[3] = {k1, k2, k3};
@ -57,5 +57,15 @@ int generate_triangle_group(groupelement_t *group, int size, int k1, int k2, int
} }
} }
for(int i = 0; i < size; i++) {
cur = &group[i];
inv = &group[0];
while(cur->parent && inv) {
inv = inv->adj[cur->letter];
cur = cur->parent;
}
group[i].inverse = inv;
}
return n; return n;
} }

View File

@ -8,11 +8,12 @@
#include "queue.h" #include "queue.h"
typedef struct _groupelement { typedef struct _groupelement {
int id; int id;
int length; int length;
struct _groupelement *adj[3]; struct _groupelement *adj[3];
struct _groupelement *parent; struct _groupelement *parent;
int letter; struct _groupelement *inverse;
int letter;
} groupelement_t; } groupelement_t;
int generate_triangle_group(groupelement_t *group, int size, int k1, int k2, int k3); int generate_triangle_group(groupelement_t *group, int size, int k1, int k2, int k3);

View File

@ -11,7 +11,7 @@ set yrange [0:20]
set grid set grid
set parametric set parametric
plot file using 1:2 w p pt 7 ps 1 lc 1 t "" plot file using 2:3 w p pt 7 ps 1 lc 1 t ""
pause mouse keypress pause mouse keypress
if(MOUSE_KEY == 60) param=param-0.02 if(MOUSE_KEY == 60) param=param-0.02