-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompletenet.c
More file actions
54 lines (39 loc) · 818 Bytes
/
completenet.c
File metadata and controls
54 lines (39 loc) · 818 Bytes
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
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <stdlib.h>
#define D 20 //maximum depth
int main(int argc,char* argv[])
{
int d,size[D],layers,hidden,instart,outstart,i,j;
char *netfile;
FILE *fp;
if(argc==1)
{
printf("expected list of two or more integers (layer sizes) followed by netfile name\n");
return 1;
}
for(d=0;d<argc-2;++d)
size[d]=atoi(argv[d+1]);
layers=argc-3;
netfile=argv[argc-1];
hidden=0;
for(d=1;d<layers;++d)
hidden+=size[d];
fp=fopen(netfile,"w");
fprintf(fp,"%d %d %d\n\n",size[0],hidden,size[layers]);
instart=0;
outstart=size[0];
for(d=1;d<layers+1;++d)
{
for(j=0;j<size[d];++j)
{
fprintf(fp,"%d %d\n",outstart+j,size[d-1]);
for(i=0;i<size[d-1];++i)
fprintf(fp,"%d ",instart+i);
fprintf(fp,"\n");
}
instart+=size[d-1];
outstart+=size[d];
}
fclose(fp);
return 0;
}