ex-6: fix EMD typo
This commit is contained in:
parent
f60f1f65d3
commit
b9775b3602
17
ex-6/test.c
17
ex-6/test.c
@ -54,7 +54,7 @@ int show_help(char **argv) {
|
||||
* 4. Deconvolving the result with both the
|
||||
* Richardson-Lucy (RL) algorithm and the Fourier
|
||||
* transform (FFT) method;
|
||||
* 5. Computing the Earth Mover's Distance (EDM) between
|
||||
* 5. Computing the Earth Mover's Distance (EMD) between
|
||||
* the deconvolution results and the original,
|
||||
* uncorrupted sample.
|
||||
*
|
||||
@ -147,7 +147,7 @@ int main(int argc, char **argv) {
|
||||
gsl_histogram *kernel = gaussian_kernel(opts.bins, opts.sigma);
|
||||
|
||||
/* Performs experiments and record the deconvolution
|
||||
* EDM distances to the original sample.
|
||||
* EMD distances to the original sample.
|
||||
*/
|
||||
double* fft_dist = calloc(opts.num_exps, sizeof(double));
|
||||
double* rl_dist = calloc(opts.num_exps, sizeof(double));
|
||||
@ -158,7 +158,7 @@ int main(int argc, char **argv) {
|
||||
rl_dist[i] = dist.b;
|
||||
}
|
||||
|
||||
/* Compute some statistics of the EDM */
|
||||
/* Compute some statistics of the EMD */
|
||||
// 1 is the array stride.
|
||||
double fft_mean = gsl_stats_mean(fft_dist, 1, opts.num_exps);
|
||||
double fft_stdev = gsl_stats_sd(fft_dist, 1, opts.num_exps);
|
||||
@ -170,7 +170,12 @@ int main(int argc, char **argv) {
|
||||
double rl_skew = gsl_stats_skew_m_sd(rl_dist, 1, opts.num_exps, rl_mean, rl_stdev);
|
||||
double rl_min, rl_max; gsl_stats_minmax(&rl_min, &rl_max, rl_dist, 1, opts.num_exps);
|
||||
|
||||
/* Create EDM distance histograms.
|
||||
double conv_mean = gsl_stats_mean(conv_dist, 1, opts.num_exps);
|
||||
double conv_stdev = gsl_stats_sd(conv_dist, 1, opts.num_exps);
|
||||
double conv_skew = gsl_stats_skew_m_sd(conv_dist, 1, opts.num_exps, conv_mean, conv_stdev);
|
||||
double conv_min, conv_max; gsl_stats_minmax(&conv_min, &conv_max, conv_dist, 1, opts.num_exps);
|
||||
|
||||
/* Create EMD distance histograms.
|
||||
* Since the distance depends wildly on the noise we can't
|
||||
* set a fixed range and therefore use the above values.
|
||||
*/
|
||||
@ -185,7 +190,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
// print results to stderr
|
||||
fprintf(stderr, "# EDM distance\n\n");
|
||||
fprintf(stderr, "# EMD distance\n\n");
|
||||
fprintf(stderr, "## FFT deconvolution\n");
|
||||
fprintf(stderr, "- mean: %.2e\n"
|
||||
"- stdev: %.1e\n"
|
||||
@ -196,7 +201,7 @@ int main(int argc, char **argv) {
|
||||
"- skew: %.2f\n", rl_mean, rl_stdev, rl_skew);
|
||||
|
||||
// print histograms to stdout
|
||||
fprintf(stderr, "\n# EDM histogram\n");
|
||||
fprintf(stderr, "\n# EMD histogram\n");
|
||||
fprintf(stdout, "%d\n", (int)sqrt(opts.num_exps));
|
||||
gsl_histogram_fprintf(stdout, fft_hist, "%g", "%g");
|
||||
gsl_histogram_fprintf(stdout, rl_hist, "%g", "%g");
|
||||
|
Loading…
Reference in New Issue
Block a user