78fd51b292e38928eaf9e832443d44c1a48b2376
[snark14.git] / src / snark / fom_klds.c
1 /*
2  ***********************************************************
3  $SNARK_Header: S N A R K  1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4  $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/fom_klds.c $
5  $LastChangedRevision: 137 $
6  $Date: 2014-07-15 16:38:33 -0400 (Tue, 15 Jul 2014) $
7  $Author: bprommegger $
8  ***********************************************************
9  */
10
11 // Extracts the Kullback-Leibler distance as a fom
12 #include <assert.h>
13 #include "malloc.h"
14 #include "experimenter.h"
15 #include "read_eval_recon4.h"
16
17 /*
18  This function reads the kullback-leibler distance.
19
20  INPUTS:
21  itr1 - array of length niters containing the iteration numbers for the first algorithm
22  itr2 - array of length niters containing the iteration numbers for the second algorithm
23  niters - number of iterations to be read
24  keywrd1 - string containing the keyword which defines the first algorithm
25  keywrd2 - string containing the keyword which defines the second algorithm
26
27  OUTPUTS:
28  klds1 - array of length niters containing the kullback-leibler distances for the first algorithm
29  klds2 - array of length niters containing the kullback-leibler distances for the second algorithm
30  */
31 void fom_klds(int* itr1, int* itr2, int niters, char* keywrd1, char* keywrd2, double* klds1, double* klds2)
32 {
33         int i = 0;
34         double dummy_wsqd = 0.0;
35         for (i = 0; i < niters; i++)
36         {
37                 read_eval_recon4(itr1[i], keywrd1, &klds1[i], &dummy_wsqd);
38                 read_eval_recon4(itr2[i], keywrd2, &klds2[i], &dummy_wsqd);
39         }
40 }