Mercurial > hg > wm
comparison Meerwald/cmp_cox_sig.c @ 20:bd669312f068
suppress warnings, fix link errors
author | Peter Meerwald-Stadler <pmeerw@pmeerw.net> |
---|---|
date | Sat, 28 Jan 2023 23:54:58 +0100 |
parents | f83ef905a63d |
children |
comparison
equal
deleted
inserted
replaced
19:0fffb6f03ebf | 20:bd669312f068 |
---|---|
1 #include "wm.h" | 1 #include "wm.h" |
2 | 2 |
3 char *progname; | 3 char *progname; |
4 | 4 |
5 void usage(void) { | 5 void usage(void) { |
6 fprintf(stderr, "usage: %s [-h] [-C] [-o file] [-v n] -s file file\n\n", progname); | 6 fprintf(stderr, "usage: %s [-h] [-o file] [-v n] -s file file\n\n", progname); |
7 fprintf(stderr, "\t-C\t\toutput correlation only\n"); | |
8 fprintf(stderr, "\t-h\t\tprint usage\n"); | 7 fprintf(stderr, "\t-h\t\tprint usage\n"); |
9 fprintf(stderr, "\t-o file\t\toutput file\n"); | 8 fprintf(stderr, "\t-o file\t\toutput file\n"); |
10 fprintf(stderr, "\t-s file\t\toriginal signature file\n"); | 9 fprintf(stderr, "\t-s file\t\toriginal signature file\n"); |
11 fprintf(stderr, "\t-v n\t\tverbosity level\n"); | 10 fprintf(stderr, "\t-v n\t\tverbosity level\n"); |
12 exit(0); | 11 exit(0); |
26 int sig_n, in_n; | 25 int sig_n, in_n; |
27 double sig_a; | 26 double sig_a; |
28 double sig_mean, sig_variance; | 27 double sig_mean, sig_variance; |
29 double s1, s2, s3; | 28 double s1, s2, s3; |
30 char line[32]; | 29 char line[32]; |
31 | 30 |
32 int verbose = 0; | 31 int verbose = 0; |
33 int correlation_only = 0; | |
34 | 32 |
35 progname = argv[0]; | 33 progname = argv[0]; |
36 | 34 |
37 while ((c = getopt(argc, argv, "h?Co:s:v:")) != EOF) { | 35 while ((c = getopt(argc, argv, "h?o:s:v:")) != EOF) { |
38 switch (c) { | 36 switch (c) { |
39 case 'h': | 37 case 'h': |
40 case '?': | 38 case '?': |
41 usage(); | 39 usage(); |
42 break; | |
43 case 'C': | |
44 correlation_only = 1; | |
45 break; | 40 break; |
46 case 'o': | 41 case 'o': |
47 if ((out = fopen(optarg, "w")) == NULL) { | 42 if ((out = fopen(optarg, "w")) == NULL) { |
48 fprintf(stderr, "%s: unable to open output file %s\n", progname, optarg); | 43 fprintf(stderr, "%s: unable to open output file %s\n", progname, optarg); |
49 exit(1); | 44 exit(1); |
132 | 127 |
133 fscanf(sig, "%lf\n", &sig_x); | 128 fscanf(sig, "%lf\n", &sig_x); |
134 fscanf(in, "%lf\n", &in_x); | 129 fscanf(in, "%lf\n", &in_x); |
135 | 130 |
136 if (verbose >= 1) { | 131 if (verbose >= 1) { |
137 fprintf(stderr, "orig %f input %f\n", sig_x, in_x); | 132 fprintf(stderr, "orig %f input %f\n", sig_x, in_x); |
138 } | 133 } |
139 | 134 |
140 s1 += sig_x * in_x; | 135 s1 += sig_x * in_x; |
141 s2 += in_x * in_x; | 136 s2 += in_x * in_x; |
142 s3 += sig_x * sig_x; | 137 s3 += sig_x * sig_x; |