Using stdlib.h rather than malloc.h
[snark14.git] / src / snark / fom_weighted_squared_distance.c
1 /*
2  ***********************************************************
3  $SNARK_Header$
4  $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/fom_klds.c $
5  $LastChangedRevision: 85 $
6  $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
7  $Author: agulati $
8  ***********************************************************
9  */
10
11 // Extracts the weighted squared distance as a fom
12 #include <assert.h>
13 #include <stdlib.h>
14 #include "experimenter.h"
15 #include "read_eval_recon4.h"
16
17 /*
18  This function reads the weighted squared 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  wsqd1 - array of length niters containing the weighted squared distance for the first algorithm
29  wsqd2 - array of length niters containing the weighted squared distance for the second algorithm
30  */
31 void fom_weighted_squared_distance(int* itr1, int* itr2, int niters,
32                 char* keywrd1, char* keywrd2, double* wsqd1, double* wsqd2) {
33         int i = 0;
34         double dummy_for_klds;
35         for (i = 0; i < niters; i++) {
36                 read_eval_recon4(itr1[i], keywrd1, &dummy_for_klds, &wsqd1[i]);
37                 read_eval_recon4(itr2[i], keywrd2, &dummy_for_klds, &wsqd2[i]);
38         }
39 }