#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; string currentFileName; 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); } ifstream inputFileNames(inputFileListName.c_str()); ofstream outputFile(outputFileName.c_str()); string prefixPath(inputPath.c_str()); string metricName(distributionType.c_str()); if (inputFileNames.fail() == true) { cout << "Input File can not be opened"<>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