typedef struct tuple { int n; int weight; int *data; }n_tuple; typedef struct space { int dim; int mod; int size; n_tuple *points; }f_space; f_space *createSpace(int dimension, int mod) { f_space *myspace = (f_space *)malloc(sizeof(f_space)); if (myspace == NULL) return NULL; myspace->dim = dimension; myspace->mod = mod; myspace->size = pow(mod, dimension); myspace->points = (n_tuple *)malloc(sizeof(n_tuple)*myspace->size); if (myspace->points == NULL) return NULL; int i; int j; for (i = 0;i < myspace->size;i++) { myspace->points[i].n = dimension; myspace->points[i].data = (int *)malloc(sizeof(int)*dimension); if (myspace->points[i].data == NULL) return NULL; for (j = 0;j < dimension;j++) { myspace->points[i].data[j] = 1; } } return myspace; }

Any help is appriciated. If there isn't an algorithm for n dimensions, a suggestion for one in a fixed dimension (say 3) is also welcome as I will simply hard code each dimension I need to work with. One thing I forgot to mention, in the code, the variable mod stands for the characteristic of the Galois field, so GF(mod) = {0,1,2,...,mod - 1}. Thank you.

This post has been edited by **Korupt**: 23 July 2013 - 05:10 PM