-
Notifications
You must be signed in to change notification settings - Fork 0
/
write.c
76 lines (69 loc) · 1.53 KB
/
write.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "main.h"
extern void locate(int, int);
void neuro_output_write(int wr, double* indata_tch)
{
int k;
switch (wr) {
case 0:
case 1:
printf("in:");
for (k = 1; k <= in/2; k++)
printf("%4.2f ", ot_in[0][k*2]);
printf("-> ");
printf("%7.5f, %4.2f ", ot_in[0][in+2], indata_tch[0]);
printf("hd: ");
for (k = in+3; k <= in+6; k++)
if ( k <= all+1 )
printf("%7.4f ", ot_ot[0][k]);
break;
case 2:
printf("%1d", (int)(indata_tch[0] * 9.999));
printf(":");
for (k = in+2; k <= all+1; k++) {
printf("%1d", (int)(fabs(ot_ot[0][k])*9.999));
if ( k == in+2 )
printf(" ");
}
break;
case 3:
printf("%1d", (int)(indata_tch[0] * 9.999));
printf(":");
for (k = in+2; k <= all+1; k++) {
printf("%1d", (int)(fabs(ot_ot[0][k])*9.999));
if ( k == in+2 ) {
printf(" ");
break;
}
}
break;
}
if (wr < 3)
putchar('\n');
}
int neuro_weight_write(int loop, int wr, int pa)
{
int k, l, xp, yp;
if (wr == 0) {
printf("th+ th- in1+ in1- in2+ in2- ...\n");
for (k = in+2; k <= all+1; k++) {
for (l = 0; l <= all+1; l++)
printf("%5.2f ", w_ot_ot[0][k][l]);
putchar('\n');
}
}
locate(0, 29);
printf("err:%3d count:%d\n", count, loop);
fflush(stdout);
yp = (int)(250 - 200 * err /pa / ot);
xp = loop + 50;
if (loop > 10000 || err < 0.1) {
locate(0,0);
printf(" %d \n", loop);
return 1;
}
line(xp, 250, xp, yp);
flush();
err = 0;
count = 0;
return 0;
}