#include #include #include #include #include #include using namespace std; vector currentHistogramValues; int main(int argc, char* argv[]) { int c; string usage = "standard-deviation -l -i -o -t "; string inputFileListName; string inputPath; string outputFileName; string distributionType; string inputFileList; while ((c = getopt (argc, argv, "i:o:l:t:h")) != -1) switch (c) { case 'l': inputFileListName = optarg; break; case 'i': inputPath = optarg; break; case 'o': outputFileName = optarg; break; case 't': distributionType = optarg; break; case 'h': cout << usage << endl; exit(1); break; default: break; } if( (inputFileListName.empty()) || (inputPath.empty()) || (distributionType.empty()) || (outputFileName.empty()) ) { cerr << usage << endl; exit(1); } // argv[1] input file containing the list of files // argv[2] output file containing the standard deviation and file name pair // argv[3] data file path // argv[4] data file postfix of metricname if (argc < 3) { cout<<"Please provide the parameters ./executable iputfilename outputfilename"<>currentFileName) { string currentFileWithExtension = prefixPath + currentFileName + "/" + currentFileName + "_"+ metricName +".txt"; cout<<"File"<> currentValueOfHistogram) { sumOfValues = sumOfValues + i*currentValueOfHistogram; currentHistogramValues.push_back(currentValueOfHistogram); N = N + currentValueOfHistogram; i=i+1.0; } M = currentHistogramValues.size(); // mean double mean = sumOfValues/N; // sigma^2 = (sum( (i-mean)^2*H_i ) )/(N-1) for i = 0 to M-1 double standardDev = 0.0; double sumSquaredResults = 0.0; int j = 0; for (i=0.0; i