//------------------------------------- private double clcACorrVar(int k, qData aData, int size) { double Var = 0; if (k < aData.size()) { List<double> tVctr = new List<double>(aData.get()); for (int i = 1; i < k; i++) { Var += (tVctr[i]) * (tVctr[i]); } Var = (1 + 2 * Var) / size; } else { //ShowMessage("Недопустимая операция 2 qData"); ; } return Var; }
//------------------------------------- private qData clcACorrVar(double procent) { List<double> tVctr = new List<double>(Vctr.Count); //результат qData tData = new qData(); tData = this; int size = tData.size(); size = (int)(((double)size) / procent); for (int i = 0; i < tVctr.Count; i++) { //C++ TO C# CONVERTER WARNING: The following line was determined to be a copy constructor call - this should be verified and a copy constructor should be created if it does not yet exist: //ORIGINAL LINE: tVctr[i] = this->clcACorrVar(i, tData, size); tVctr[i] = this.clcACorrVar(i, new qData(tData), size); } tData.set(tVctr); return tData; }
//------------------------------------- private qData clcACorrVar(qData aData) { List<double> tVctr = new List<double>(aData.size()); //результат for (int i = 0; i < tVctr.Count; i++) { //C++ TO C# CONVERTER WARNING: The following line was determined to be a copy constructor call - this should be verified and a copy constructor should be created if it does not yet exist: //ORIGINAL LINE: tVctr[i] = this->clcACorrVar(i, aData); tVctr[i] = this.clcACorrVar(i, new qData(aData)); } qData tData = new qData(tVctr); return tData; }
//------------------------------------- //C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: double clcMCovariation(int k, qData aX, qData aY)const public double clcMCovariation(int k, qData aX, qData aY) { int sizeX; int sizeY; int size; sizeX = aX.size(); sizeY = aY.size(); size = (sizeX <= sizeY) ? sizeX : sizeY; if (size != 0) { double MX; double MY; List<double> X = new List<double>(); List<double> Y = new List<double>(); if (k >= 0) { X = aX.get(); Y = aY.get(); MX = aX.clcMid(); MY = aY.clcMid(); } else { k = -k; X = aY.get(); Y = aX.get(); MX = aY.clcMid(); MY = aX.clcMid(); } //int sizeX; //int sizeY; //int size; sizeX = X.Count; sizeY = Y.Count; size = (sizeX <= sizeY) ? sizeX : sizeY; double C = 0; for (int i = 0; i < size - k; i++) { C += (X[i] - MX) * (Y[i + k] - MY); } C /= (double)size; return C; } else { return 0; } }
//------------------------------------- public qData clcMCovariation(double procent, qData aX, qData aY) { int sizeX; int sizeY; int size; sizeX = aX.size(); sizeY = aY.size(); size = (sizeX <= sizeY) ? sizeX : sizeY; size = (int)(((double)size) * procent + 0.5); List<double> tVctr = new List<double>(size); //вектор результата double C = 0; for (int i = 0; i < size; i++) { //C++ TO C# CONVERTER WARNING: The following line was determined to be a copy constructor call - this should be verified and a copy constructor should be created if it does not yet exist: //ORIGINAL LINE: C = clcMCovariation(i, aX, aY); C = clcMCovariation(i, new qData(aX), new qData(aY)); tVctr[i] = C; } qData tData = new qData(); tData.set(tVctr); return tData; }
//------------------------------------- public double clcMCorelation(int k, qData aX, qData aY) { int sizeX; int sizeY; int size; sizeX = aX.size(); sizeY = aY.size(); size = (sizeX <= sizeY) ? sizeX : sizeY; if (size != 0) { double C = 0; C = clcMCovariation(k, new qData(aX), new qData(aY)); double R = 0; double sgmX = 0; double sgmY = 0; sgmX = aX.clcVar(); sgmY = aY.clcVar(); sgmX = Math.Sqrt(sgmX); sgmY = Math.Sqrt(sgmY); if (sgmX * sgmY > 0) { R = C / (sgmX * sgmY); } else { R = 0; } return R; } else { return 0; } }