-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxor_gen.c
35 lines (31 loc) · 798 Bytes
/
xor_gen.c
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
#define NN_IMPLEMENTATION
#include "nn.h"
int main(void) {
Mat t = mat_alloc(4, 3);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
int row= i*2 + j;
MAT_AT(t, row, 0) = i;
MAT_AT(t, row, 1) = j;
MAT_AT(t, row, 2) = i & j;
}
}
// for (int i = 0; i < 2; ++i) {
// for (int j = 0; j < 2; ++j) {
// int row = i*2 + j;
// MAT_AT(t, row, 0) = i;
// MAT_AT(t, row, 1) = j;
// MAT_AT(t, row, 2) = i^j;
// }
// }
const char *out_file_path = "add.mat";
FILE *out = fopen(out_file_path, "wb");
if (out == NULL) {
fprintf(stderr, "ERROR: could not open file %s\n", out_file_path);
return 1;
}
mat_save(out, t);
fclose(out);
printf("Generated %s\n", out_file_path);
return 0;
}