new matrix allocation mechanism
This commit is contained in:
49
main.c
49
main.c
@@ -43,15 +43,6 @@ void setupContext(DrawingContext *ctx)
|
||||
ctx->cartan = gsl_matrix_alloc(3, 3);
|
||||
ctx->cob = gsl_matrix_alloc(3, 3);
|
||||
ctx->ws = workspace_alloc(3);
|
||||
ctx->tmp = malloc(MAX_TEMP_MATRICES*sizeof(gsl_matrix*));
|
||||
for(int i = 0; i < MAX_TEMP_MATRICES; i++)
|
||||
ctx->tmp[i] = gsl_matrix_alloc(3, 3);
|
||||
ctx->tmp_used = 0;
|
||||
ctx->tmp_vec = malloc(MAX_TEMP_MATRICES*sizeof(gsl_vector*));
|
||||
for(int i = 0; i < MAX_TEMP_MATRICES; i++)
|
||||
ctx->tmp_vec[i] = gsl_vector_alloc(3);
|
||||
ctx->tmp_vec_used = 0;
|
||||
|
||||
}
|
||||
|
||||
void destroyContext(DrawingContext *ctx)
|
||||
@@ -63,13 +54,6 @@ void destroyContext(DrawingContext *ctx)
|
||||
gsl_matrix_free(ctx->cob);
|
||||
|
||||
workspace_free(ctx->ws);
|
||||
|
||||
for(int i = 0; i < MAX_TEMP_MATRICES; i++)
|
||||
gsl_matrix_free(ctx->tmp[i]);
|
||||
free(ctx->tmp);
|
||||
for(int i = 0; i < MAX_TEMP_VECTORS; i++)
|
||||
gsl_vector_free(ctx->tmp_vec[i]);
|
||||
free(ctx->tmp_vec);
|
||||
}
|
||||
|
||||
void updateMatrices(DrawingContext *ctx)
|
||||
@@ -212,39 +196,6 @@ int main()
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
|
||||
// do stuff
|
||||
/*
|
||||
DrawingContext *ctx = screen_context;
|
||||
gsl_matrix *tmp = getTempMatrix(ctx);
|
||||
gsl_matrix *ev = getTempMatrix(ctx);
|
||||
gsl_matrix *evinv = getTempMatrix(ctx);
|
||||
gsl_matrix **gen = getTempMatrices(ctx, 3);
|
||||
gsl_matrix *transform = getTempMatrix(ctx);
|
||||
vector_t eigenvectors[3][3];
|
||||
char words[3][4] = {"abc", "bca", "cab"};
|
||||
|
||||
initializeTriangleGenerators(gen, ctx->cartan);
|
||||
|
||||
gsl_matrix_set_identity(tmp);
|
||||
for(int j = 0; j < strlen(words[0]); j++)
|
||||
multiply_right(tmp, gen[words[0][j]-'a'], ctx->ws);
|
||||
real_eigenvectors(tmp, ev, ctx->ws);
|
||||
invert(ev, evinv, ctx->ws);
|
||||
|
||||
|
||||
LOOP(i) {
|
||||
gsl_matrix_set_identity(tmp);
|
||||
for(int j = 0; j < strlen(words[i]); j++)
|
||||
multiply_right(tmp, gen[words[i][j]-'a'], ctx->ws);
|
||||
real_eigenvectors(tmp, ev, ctx->ws);
|
||||
LOOP(j) LOOP(k) eigenvectors[i][j].x[k] = gsl_matrix_get(ev, k, j);
|
||||
}
|
||||
|
||||
// solve the following: (x + y + z) (l) = lambda w
|
||||
|
||||
return 0;
|
||||
*/
|
||||
|
||||
info = initCairo(0, KeyPressMask, 200, 200, "Triangle group");
|
||||
if(!info)
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user