#include "MinMaxAnalysis.h" #include "MathUtil.h" MinMaxAnalysis::MinMaxAnalysis(const QVector &rMat, MinMaxAnalysis::AnalysisType type, qreal _k, qreal _q) : analysisType(type), originMat(rMat), k(_k), q(_q) { calcNormalMat(); } const QVector &MinMaxAnalysis::normalization() { return normalMat; } MinMaxAnalysis::Relations MinMaxAnalysis::getRelations() const { return Relations(); } void MinMaxAnalysis::calcNormalMat() { switch (analysisType) { case Min_Analysis: { for (auto index : originMat) { double minVal = Helper::minvec(index); EvaluateIndex ei; for (auto v : index) { ei << v / minVal; } normalMat << ei; } } break; case Max_Analysis: { for (auto index : originMat) { double maxVal = Helper::maxvec(index); EvaluateIndex ei; for (auto v : index) { ei << v / maxVal; } normalMat << ei; } } break; case Analysis_THD1: { for (auto index : originMat) { double minVal = Helper::minvec(index); double maxVal = Helper::maxvec(index); EvaluateIndex ei; for (auto v : index) { ei << (minVal + maxVal - v) / maxVal; } normalMat << ei; } } break; case Analysis_THD2: { for (auto index : originMat) { double minVal = Helper::minvec(index); double maxVal = Helper::maxvec(index); EvaluateIndex ei; for (auto v : index) { ei << (maxVal - v) / (maxVal - minVal); } normalMat << ei; } } break; case Analysis_THD3: { for (auto index : originMat) { double minVal = Helper::minvec(index); double maxVal = Helper::maxvec(index); EvaluateIndex ei; for (auto v : index) { ei << (v - minVal) / (maxVal - minVal); } normalMat << ei; } } break; case Analysis_THD4: { for (auto index : originMat) { double minVal = Helper::minvec(index); double maxVal = Helper::maxvec(index); EvaluateIndex ei; for (auto v : index) { ei << (v - minVal) * k / (maxVal - minVal) + q; } normalMat << ei; } } break; } }