📄 stat_05.cc
字号:
} } // Algorithm: SKEW // else if (algorithm_d == SKEW) { return Error::handle(name(), L"computeFrameAccumulate", ERR_UNKIMP, __FILE__, __LINE__); } // Algorithm: KURTOSIS // else if (algorithm_d == KURTOSIS) { return Error::handle(name(), L"computeFrameAccumulate", ERR_UNKIMP, __FILE__, __LINE__); } else { // unsupported input // return Error::handle(name(), L"computeFrameAccumulate", ERR_UNKIMP, __FILE__, __LINE__); } // set the calculated flag // is_calculated_d = true; // exit gracefully // return status;}// method: computeSampleAccumulate// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// AlgorithmData::COEF_TYPE input_coef_type: (input) type of input// long index: (input) channel index//// return: a boolean value indicating status//// this method returns the required statistical parameter for the// input data//boolean Statistics::computeSampleAccumulate(VectorFloat& output_a, const VectorFloat& input_a, AlgorithmData::COEF_TYPE input_coef_type_a, long index_a) { // set the length of the output vector: should be 1 as it only // contains the one value // output_a.setLength(1); accum_samples_d += input_a.length(); accum_sum_d(index_a).getVectorFloat()(0) += input_a.sum(); accum_sumsqr_d(index_a).getVectorFloat()(0) += input_a.sumSquare(); // Algorithm: MEAN // if (algorithm_d == MEAN) { output_a.setLength(1); output_a(0) = accum_sum_d(index_a).getVectorFloat()(0) / (float)accum_samples_d; } // Algorithm: MINIMUM, MINIMUM_MAG, MAXIMUM, MAXIMUM_MAG // else if (algorithm_d == MINIMUM || algorithm_d == MINIMUM_MAG || algorithm_d == MAXIMUM || algorithm_d == MAXIMUM_MAG) { // First frame and the rest of frame is different // if (frame_index_d == 0) { computeFrameInt(output_a, input_a); accum_result_d(index_a).getVectorFloat()(0) = output_a(0); } else { VectorFloat temp(1); temp(0) = accum_result_d(index_a).getVectorFloat()(0); temp.concat(input_a); computeFrameInt(output_a, temp); } //end of else frame_index_d accum_result_d(index_a).getVectorFloat()(0) = output_a(0); } //end of else if algorithm_d // Algorithm: MEDIAN // else if (algorithm_d == MEDIAN) { if (frame_index_d == 0) { accum_frame_data_d(index_a).getVectorFloat().assign(input_a); } else { accum_frame_data_d(index_a).getVectorFloat().concat(input_a); } //end of else frame_index_d computeMedian(output_a, accum_frame_data_d(index_a).getVectorFloat()); } // Algorithm: VARIANCE // else if (algorithm_d == VARIANCE) { output_a(0) = accum_sumsqr_d(index_a).getVectorFloat()(0) - accum_sum_d(index_a).getVectorFloat()(0) * accum_sum_d(index_a).getVectorFloat()(0) / (float)accum_samples_d; output_a(0) /= (float)accum_samples_d; } // Algorithm: STDEV // else if (algorithm_d == STDEV) { output_a(0) = accum_sumsqr_d(index_a).getVectorFloat()(0) - accum_sum_d(index_a).getVectorFloat()(0) * accum_sum_d(index_a).getVectorFloat()(0) / (float)accum_samples_d; output_a(0) /= (float)accum_samples_d; output_a(0) = Integral::sqrt(output_a(0)); } // Algorithm: SKEW // else if (algorithm_d == SKEW) { return Error::handle(name(), L"computeSampleAccumulate", ERR_UNKIMP, __FILE__, __LINE__); } // Algorithm: KURTOSIS // else if (algorithm_d == KURTOSIS) { return Error::handle(name(), L"computeSampleAccumulate", ERR_UNKIMP, __FILE__, __LINE__); } // an unknown input type was specified // else { return Error::handle(name(), L"computeSampleAccumulate", ERR_UNKALG, __FILE__, __LINE__); } // set the calculated flag // is_calculated_d = true; // exit gracefully // return true;}// method: computeMin// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// // return: a boolean value indicating status//// this method returns the minimum of the input data//boolean Statistics::computeMin(VectorFloat& output_a, const VectorFloat& input_a) { // set the length of the output vector: should be 1 as it only // contains the minimum value // output_a.setLength(1); // assign the value of minimum to the output // output_a(0) = input_a.min(); // exit gracefully // return true;}// method: computeMax// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// // return: a boolean value indicating status//// this method return the maximum of the input data //boolean Statistics::computeMax(VectorFloat& output_a, const VectorFloat& input_a) { // set the length of the output vector: should be 1 as it only // contains the maximum value // output_a.setLength(1); // assign the value of maximum to the output // output_a(0) = input_a.max(); // exit gracefully // return true;}// method: computeMinMag// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// // return: a boolean value indicating status//// this method return the minimum magnitude of the input data//boolean Statistics::computeMinMag(VectorFloat& output_a, const VectorFloat& input_a) { // set the length of the output vector: should be 1 as it only // contains the minimum magnitude value // output_a.setLength(1); // assign the value of minimum magnitude to the output // output_a(0) = input_a.minMag(); // exit gracefully // return true;}// method: computeMaxMag// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// // return: a boolean value indicating status//// this method returns the maximum magnitude of the input data//boolean Statistics::computeMaxMag(VectorFloat& output_a, const VectorFloat& input_a) { // set the length of the output vector: should be 1 as it only // contains the maximum magnitude value // output_a.setLength(1); // assign the value of maximum magnitude to the output // output_a(0) = input_a.maxMag(); // exit gracefully // return true;}// method: computeVar// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// // return: a boolean value indicating status//// this method returns the variance of the input data//boolean Statistics::computeVar(VectorFloat& output_a, const VectorFloat& input_a) { // set the length of the output vector: should be 1 as it only // contains the variance // output_a.setLength(1); // assign the value of variance // output_a(0) = input_a.var(); // exit gracefully // return true;}// method: computeStdDev// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// // return: a boolean value indicating status//// this method returns the standard deviation of the input data//boolean Statistics::computeStdDev(VectorFloat& output_a, const VectorFloat& input_a) { // set the length of the output vector: should be 1 as it only // contains the standard deviation // output_a.setLength(1); // assign the value of standard deviation // output_a(0) = input_a.stdev(); // exit gracefully // return true;}// method: computeMedian// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// // return: a boolean value indicating status//// this method returns the median of the input data//boolean Statistics::computeMedian(VectorFloat& output_a, const VectorFloat& input_a) { // set the length of the output vector: should be 1 as it only // contains the median // output_a.setLength(1); // assign the value of the median // output_a(0) = input_a.median(); // exit gracefully // return true;}// method: computeMean// // arguments:// VectorFloat& output: (output) output data// const VectorFloat& input: (input) input data// // return: a boolean value indicating status//// this method returns the mean of the input data //boolean Statistics::computeMean(VectorFloat& output_a, const VectorFloat& input_a) { // set the length of the output vector: should be 1 as it only // contains the mean // output_a.setLength(1); // assign the value of the mean // output_a(0) = input_a.mean(); // exit gracefully // return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -