calculate inverses
This commit is contained in:
parent
b144b77206
commit
386387569b
4
Makefile
4
Makefile
@ -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
2
main.c
@ -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++)
|
||||||
|
12
triangle.c
12
triangle.c
@ -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;
|
||||||
}
|
}
|
||||||
|
11
triangle.h
11
triangle.h
@ -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);
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user