-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdata.h
executable file
·46 lines (40 loc) · 1.11 KB
/
data.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef DATA_H_
#define DATA_H_
typedef struct {
int *g; // int array storing genotype. Consider using the binary compression? however, this limits to the number of bits avaialble.
bool is_compatible; // true if compatible with model
double* t; // time of each event.
int** P; // poset used for induced refinement of the poset.
int* subset; // Binary array indicating compatibility of valid genotypes with this data point.
int count; // number of observations of this type
} data;
void free_data_array(data* D, int N_u, const int n) {
for (int i=0; i< N_u; i++) {
free(D[i].g);
free_int_matrix(D[i].P, n);
free_double_array(D[i].t);
free_int_array(D[i].subset);
}
free(D);
}
void print_data(data D, const int n) {
printf("Data struct:\n");
printf("Genotype: ");
for (int i=0; i < n; i++) {
printf("%d ", D.g[i]);
}
printf("\n");
printf("Count = %d\n", D.count);
printf("is compatible? ... ");
if (D.is_compatible) {
printf("true.\n");
} else {
printf("false.\n");
}
}
void print_data_array(data* D, int N_u, const int n) {
for (int i=0; i< N_u; i++) {
print_data(D[i], n);
}
}
#endif