Пример #1
0
 //---------------------------------------------------------------------------
 public qData(qData aData)
 {
     //    int size = 0;
     //    size = aData.get().size();
     this.Vctr = aData.get();
     //    size = this->Vctr.size();
 }
Пример #2
0
 //copy
 //---------------------------------------------------------------------------
 public qData AddRange(qData aData)
 {
     List<double> tVctr1 = new List<double>();
     List<double> tVctr2 = new List<double>();
     tVctr1 = aData.get();
     tVctr2 = this.Vctr;
     tVctr2.AddRange(tVctr1);
     qData tData = new qData();
     tData.set(tVctr2);
     return tData;
 }
Пример #3
0
 //-------------------------------------
 public qData clcDifference(int d)
 {
     qData tData = new qData();
     tData = this;
     for (int i = 0; i < d; i++)
     {
         tData = tData.clcDifference();
     }
     return tData;
 }
Пример #4
0
        //---------------------------------------------------------------------------
        public void mkMaskModel()
        {
            List<double> mdl = new List<double>();
            List<double> mdlAR = new List<double>();
            List<double> mdlMA = new List<double>();

            //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: this->Model = ModelAR.add(ModelMA);
            this.Model = ModelAR.AddRange(new qData(ModelMA));
            mdl = Model.get();
            mdlAR = ModelAR.get();
            mdlMA = ModelMA.get();

            try
            {
                int size;
                size = Mask.Count;
                for (int i = 0; i < size; i++)
                {
                    mdl[i] = mdl[i] * Mask[i];
                }
                size = MaskAR.Count;
                for (int i = 0; i < size; i++)
                {
                    mdlAR[i] = mdlAR[i] * MaskAR[i];
                }
                size = MaskMA.Count;
                for (int i = 0; i < size; i++)
                {
                    mdlMA[i] = mdlMA[i] * MaskMA[i];
                }

                Model.set(mdl);
                ModelAR.set(mdlAR);
                ModelMA.set(mdlMA);

            }
            catch
            {
                throw new System.ApplicationException("Размер модели и маски не совпадает");
            }
        }
Пример #5
0
        //-------------------------------------
        public qData clcMulPolinoms(qData aD1, qData aD2)
        {
            /*
            List<List<double> > Mtrx = new List<List<double> >();
            List<double> Poly1 = new List<double>();
            List<double> Poly2 = new List<double>();
            Poly1 = aD1.get();
            Poly2 = aD2.get();
             //C++ TO C# CONVERTER TODO TASK: There is no direct equivalent to the STL vector 'insert' method in C#:
            Poly1.insert(Poly1.GetEnumerator(), 0);
             //C++ TO C# CONVERTER TODO TASK: There is no direct equivalent to the STL vector 'insert' method in C#:
            Poly2.insert(Poly2.GetEnumerator(), 0);
            int size1;
            int size2;
            size1 = Poly1.Count;
            size2 = Poly2.Count;
            int sizeM; // столбцов
            sizeM = size1 + size2 - 1;
            int sizeN; // строк
            sizeN = size1;
            Mtrx = new List<List<double> > (sizeN,List<double> (sizeM, 0));
            // сумма

            for(int i = 0; i < size1; i++)
            {
               Mtrx[0][i] = Poly1[i];
            }
            for(int i = 0; i < size2; i++)
            {
               Mtrx[0][i] = Mtrx[0][i] + Poly2[i];
            }
            // умножение на j множитель
            for(int j = 1; j < sizeN; j++)
            {
               for(int i = 1; i < size2; i++)
               {
                  Mtrx[j][j+i] = Poly1[j]*Poly2[i];
               }
            }
            // сумма по столбцам
            for(int i = 1; i < sizeM; i++)
            {
               double summa = 0;
               for(int j = 0; j < sizeN; j++)
               {
                  summa += Mtrx[j][i];
               }
               Mtrx[0][i] = summa;
            }
            Poly1 = Mtrx[0];
             //C++ TO C# CONVERTER TODO TASK: There is no direct equivalent to the STL vector 'erase' method in C#:
            Poly1.erase(Poly1.GetEnumerator());
            qData tData = new qData();
            tData.set(Poly1);
            return tData;
             */
            throw new System.NotImplementedException();
        }
Пример #6
0
 //-------------------------------------
 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;
 }
Пример #7
0
 //-------------------------------------
 public qData clcACorrelation(double procent)
 {
     List<double> tVctr = new List<double>(); //вектор результата
     tVctr = this.clcACovariation().get();
     int size;
     size = tVctr.Count;
     size = (int)(((double)size) * procent + 0.5);
     if (tVctr.Count > 0)
     {
         if (tVctr[0] != 0)
         {
             double D = tVctr[0];
             for (int i = 0; i < size; i++)
             {
                 tVctr[i] = tVctr[i] / D;
             }
         }
         else
         {
             tVctr = new List<double>(tVctr.Count);
             tVctr[0] = 1;
         }
     }
     List<double> tVctr2 = new List<double>();
     tVctr2.AddRange(tVctr);
     qData tData = new qData(tVctr2);
     return tData;
 }
Пример #8
0
 //-------------------------------------
 public qData clcPCorrSgmMin(double k, double procent)
 {
     int size = 0;
     size = this.Vctr.Count;
     int sizeAll = 0;
     sizeAll = (int)(((double)size) / procent);
     double value = -Math.Sqrt((double)(k) / (double)(sizeAll));
     //List<double> tVctr = new List<double>(size,value); //результат
     List<double> tVctr = new List<double>(size);
     for (int i = 0; i < tVctr.Count; i++)
     {
         tVctr[i] = value;
     }
     throw new System.NotImplementedException();
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #9
0
 //-------------------------------------
 private qData clcACorrSgm(qData aCorr, double k)
 {
     List<double> tVctr = new List<double>(); //результат
     tVctr = aCorr.get();
     for (int i = 0; i < tVctr.Count; i++)
     {
         tVctr[i] = Math.Sqrt(k * tVctr[i]);
     }
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #10
0
        //-------------------------------------
        /// <summary>
        /// Частная автокорреляционная функция
        /// </summary>
        /// <returns></returns>
        public qData clcPCorrelation()
        {
            int size = 0;
            size = this.Vctr.Count;
            //   std::vector<std::vector<double> > F( size, std::vector<double> (size,0));
            List<List<double>> F = new List<List<double>>(size);
            for (int i = 1; i < size; i++)
            {
                F[i] = new List<double>(i + 1);
            }
            F[0] = new List<double>(size);

            F[1][1] = Vctr[1];
            F[0][1] = F[1][1];
            for (int p = 1; p < size - 1; p++)
            {
                double S1 = 0;
                double S2 = 0;
                for (int j = 1; j <= p; j++)
                {
                    S1 = S1 + F[p][j] * Vctr[p + 1 - j];
                }
                for (int j = 1; j <= p; j++)
                {
                    S2 = S2 + F[p][j] * Vctr[j];
                }
                F[p + 1][p + 1] = (Vctr[p + 1] - S1) / (1 - S2);
                for (int j = 1; j <= p; j++)
                {
                    F[p + 1][j] = F[p][j] - F[p + 1][p + 1] * F[p][p + 1 - j];
                    S1 = F[p][j] - F[p + 1][p + 1] * F[p][p + 1 - j];
                }
                F[0][p + 1] = F[p + 1][p + 1];
            }
            //qData tData = new qData( ref F[0] );
            List<double> tmp = F[0];
            qData tData = new qData(tmp);
            return tData;
        }
Пример #11
0
 //-------------------------------------
 /// <summary>
 /// Автокорреляционная функция
 /// </summary>
 /// <returns></returns>
 public qData clcACorrelation()
 {
     List<double> tVctr = new List<double>(); //вектор результата
     tVctr = this.clcACovariation().get();
     if (tVctr.Count > 0)
     {
         if (tVctr[0] != 0)
         {
             //List<double>.iterator p = new List<double>.iterator();
             double D = tVctr[0];
             //for(p = tVctr.GetEnumerator(); p != tVctr.end(); p++)
             int size = this.Vctr.Count;
             for (int i = 0; i < size; i++)
             {
                 tVctr[i] = tVctr[i] / D;
             }
         }
         else
         {
             tVctr = new List<double>(tVctr.Count);
             tVctr[0] = 1;
         }
     }
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #12
0
 //    
 //
 //-------------------------------------
 /// <summary>
 /// Автоковариационная функция
 /// </summary>
 /// <returns></returns>
 public qData clcACovariation()
 {
     List<double> tVctr = new List<double>(Vctr.Count); //вектор результата
     if (Vctr.Count != 0)
     {
         double M;
         M = this.clcMid();
         List<double> dif = new List<double>(Vctr); //отклонение от среднего
         int size = this.Vctr.Count;
         for (int i = 0; i < size; i++)
         {
             dif[i] = dif[i] - M;
         }
         for (int k = 0; k != dif.Count - 1; k++) //по всем задержкам
         {
             double C = 0;
             for (int i = 0; i < size - k; i++)
             {
                 C += dif[i] * dif[i + k];
             }
             C /= dif.Count;
             tVctr[k] = C;
         }
     }
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #13
0
 //-------------------------------------
 //difference
 //-------------------------------------
 public qData clcDifference()
 {
     int size = this.Vctr.Count;
     List<double> tVctr = new List<double>(size);
     for (int i = 1; i < size; i++)
     {
         tVctr[i] = Vctr[i] - Vctr[i - 1];
     }
     tVctr[0] = Vctr[0];
     qData tData = new qData();
     tData.set(tVctr);
     return tData;
 }
Пример #14
0
 //-------------------------------------
 public qData clcACorrSgmMin(qData aACSgm)
 {
     List<double> tVctr = new List<double>(); //результат
     tVctr = aACSgm.get();
     for (int i = 0; i < tVctr.Count; i++)
     {
         tVctr[i] = -tVctr[i];
     }
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #15
0
 //-------------------------------------
 public qData clcACorrSgm(double k, double procent)
 {
     List<double> tVctr = new List<double>(); //результат
     tVctr = this.clcACorrVar(procent).get();
     //int size = tVctr.size()
     for (int i = 0; i < tVctr.Count; i++)
     {
         tVctr[i] = Math.Sqrt(k * tVctr[i]);
     }
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #16
0
 //-------------------------------------
 public qData clcACorrSgm(double k)
 {
     List<double> tVctr = new List<double>(); //результат
     tVctr = this.clcACorrVar().get();
     for (int i = 0; i < tVctr.Count; i++)
     {
         tVctr[i] = (double)Math.Sqrt(k * tVctr[i]);
     }
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #17
0
        //---------------------------------------------------------------------------
        //---------------------------------------------------------------------------
        public qData revisionParam()
        {
            //для каждого Betta вычислить производную
            //сформировать матрицы А и g
            // нормировать матрицы А и g
            // найти h
            // вычислить поправки
            //oooooooooooooooooooooooooooooo
            //ofstream @out = new ofstream("tmpModArm.rpt");
            //@out << "Вычисление параметров модели АРСС";
            //@out << "\n";
            //oooooooooooooooooooooooooooooo

            double delta = 0.1;
            double cf_P = 0.1;
            // double cf_P = 2.0;
            double cf_E = 0.0001;
            double cf_F2 = 1.8;
            int p;
            int q;
            int k;
            int n;
            List<double> Zdm = new List<double>(); // ряд исхлдный

            p = this.Np;
            q = this.Nq;
            k = p + q;

            //   p = ModelAR.size();
            //   q = ModelMA.size();
            //   k = Model.size();

            Zdm = this.ZDM.get();
            n = Zdm.Count;
            List<double> A0 = new List<double>(n);
            List<double> Ab = new List<double>(n);
            List<double> B0 = new List<double>();
            List<double> Bd = new List<double>();
            List<double> BZero = new List<double>();
            BZero = this.Model.get();
            B0 = delZero(BZero, Mask);
            //Удалить 3 посл. значения - tetta0 SgmA2, M;   //B0.pop_back();   B0.pop_back();   B0.pop_back();
            //создал Х
            //List<List<double> > X = new List<List<double> >(k, List<double> (n, 0));
            List<List<double>> X = new List<List<double>>(k);
            for (int i = 0; i < k; i++)
            {
                X[i] = new List<double>(n);
            }

            // матрицы
            qMData MA = new qMData();
            qMData MG = new qMData(); // MG.set( MG.clcMtrx( G, G.size() ) );
            qMData MH = new qMData(); // MH.set( MH.clcMtrx( H, H.size() ) );
            try
            {
                for (int c = 0; c <= 100; c++)
                {
                    // заполнение Х-------------
                    BZero = addZero(B0, Mask);
                    this.forecast(BZero, Zdm, ref A0, 0);

                    for (int i = 0; i < k; i++)
                    {
                        Bd = B0;
                        Bd[i] = Bd[i] + delta;
                        BZero = addZero(Bd, Mask);
                        this.forecast(BZero, Zdm, ref Ab, 0);
                        for (int j = 0; j < n; j++)
                        {
                            X[i][j] = (A0[j] - Ab[j]) / delta;
                        }
                    }
                    // Заполнение А
                    //List<List<double> > A = new List<List<double> >(k, List<double> (k, 0));
                    List<List<double>> A = new List<List<double>>(k);
                    for (int i = 0; i < k; i++)
                    {
                        A[i] = new List<double>(k);
                    }

                    for (int i = 0; i < k; i++)
                    {
                        for (int j = 0; j < k; j++)
                        {
                            double S = 0;
                            for (int t = 0; t < n; t++)
                            {
                                S += X[i][t] * X[j][t];
                            }
                            A[i][j] = S;
                        }
                    }
                    // Заполнение G
                    List<double> G = new List<double>(k);
                    for (int i = 0; i < k; i++)
                    {
                        double S = 0;
                        for (int t = 0; t < n; t++)
                        {
                            S += X[i][t] * A0[t]; //+++++++++++++++++++++++
                        }
                        G[i] = S;
                    }
                    // нормирующие величины
                    List<double> D = new List<double>(k);
                    for (int i = 0; i < k; i++)
                    {
                        D[i] = Math.Sqrt(A[i][i]);
                    }
                    // модифицировать
                    for (int i = 0; i < k; i++)
                    {
                        for (int j = 0; j < k; j++)
                        {
                            if (i != j)
                            {
                                double delitel;
                                delitel = D[i] * D[j];
                                if (delitel != 0)
                                {
                                    A[i][j] = A[i][j] / delitel;
                                }
                            }
                            else
                            {
                                A[i][j] = 1 + cf_P;
                            }
                        }
                    }
                    for (int i = 0; i < k; i++)
                    {
                        if (D[i] != 0)
                        {
                            G[i] = G[i] / D[i];
                        }
                    }
                    //решение ур-Ыния Ah = g   // заполнить матр А и обратить   // умножить на g: H = Аобр*G
                    MA.set(A);
                    MG.set(MG.clcMtrx(G, G.Count));
                    //MA = MA.clcPIMatrix(MA.get());
                    throw new System.NotImplementedException();
                    MH = MA * MG;
                    List<double> H = new List<double>(k);
                    H = MH.clcVctr(MH.get());
                    for (int i = 0; i < k; i++)
                    {
                        if (D[i] != 0)
                        {
                            H[i] = H[i] / D[i];
                        }
                    }
                    for (int i = 0; i < k; i++)
                    {
                        Bd[i] = B0[i] + H[i];
                    }
                    // оценка остаточных ошибок
                    double Sb = 0;
                    double S0 = 0;
                    BZero = addZero(Bd, Mask);
                    this.forecast(BZero, Zdm, ref Ab, 0);
                    qData tClc = new qData();
                    S0 = tClc.clcAmountSquare(ref A0);
                    Sb = tClc.clcAmountSquare(ref Ab);

                    /*
                    @out << "Итерация:";
                    @out << "\t";
                    @out << c;
                    @out << "\n";
                    @out << "Текущие параметры:";
                    @out << "\n";
                    for(int i = 0; i < k; i++)
                    {
                       @out << "K[";
                       @out << i;
                       @out << "]:\t";
                       @out << B0[i];
                       @out << "\n";
                    }
                    @out << "Var(a): ";
                    @out << S0;
                    @out << "\n";
                    @out << "Вычисленные параметры:";
                    @out << "\n";
                    for(int i = 0; i < k; i++)
                    {
                       @out << "K[";
                       @out << i;
                       @out << "]:\t";
                       @out << Bd[i];
                       @out << "\n";
                    }
                    @out << "Var(a): ";
                    @out << Sb;
                    @out << "\n";
                       @out << "k_p: ";
                       @out << cf_P;
                       @out << "\n";
                       @out << "k_d: ";
                       @out << delta;
                       @out << "\n";
                    */

                    if (Sb < S0)
                    {
                        B0 = Bd;
                        //oooooooooooooooooooooooooooooo
                        //@out << "Параметры обновлены";
                        //@out << "\n";
                        //oooooooooooooooooooooooooooooo
                        // достигнута сходимость если: H[i] < e
                        bool flag = true;
                        for (int i = 0; i < k; i++)
                        {
                            if (!((H[i] > -cf_E) && (H[i] < cf_E)))
                            {
                                flag = false;
                            }
                        }
                        if (flag == true)
                        {
                            //++++++++++++++++
                            // запомнить А матрицу
                            // запомнить а для расчета автокорреляций
                            //ShowMessage("Число итераций:"+IntToStr(c));
                            break;
                        }
                        else
                        {
                            cf_P = cf_P / cf_F2;
                            if (cf_P < 0.001)
                            {
                                cf_P = 0.001;
                            }
                            //qwooooooooooooooooo
                            //delta = delta/cf_F2;
                            //if( delta < 0.001){
                            //    delta = 0.001;
                            //}//qwooooooooooooooooo
                        }
                    }
                    else
                    {
                        cf_P = cf_P * cf_F2;
                        if (cf_P > 8)
                        {
                            //cf_P = 5;
                            break;
                        }
                        //qwooooooooooooooooo
                        //delta = delta*cf_F2;
                        //if( delta > 0.1){
                        //   delta = 0.1;
                        //}//qwooooooooooooooooo
                    }
                }
                //------------------------------
            }
            catch
            {
                throw new System.ApplicationException("Исключение при уточнении параметров");
                //oooooooooooooooooooooooooooooo
                //@out.close();
                //oooooooooooooooooooooooooooooo
                return Model;
            }
            //------------------------
            List<double> PPar = new List<double>();
            List<double> QPar = new List<double>();
            BZero = addZero(B0, Mask);
            //PPar.AddRange(BZero.GetEnumerator(), BZero.GetEnumerator() + P);
            //QPar.AddRange(BZero.GetEnumerator()+P, BZero.GetEnumerator() + P+Q);
            throw new System.NotImplementedException();
            ModelAR.set(PPar);
            ModelMA.set(QPar);
            //------------------------
            //oooooooooooooooooooooooooooooo
            //@out.close();
            //oooooooooooooooooooooooooooooo
            qData tData = new qData();
            tData.set(BZero);
            //C++ TO C# CONVERTER WARNING: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created if it does not yet exist:
            //ORIGINAL LINE: Model = tData;
            Model.set(tData);
            return tData;
        }
Пример #18
0
 //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
 //   qData getZpls();
 //---------------------------------------------------------------------------
 public void mkUpdate()
 {
     double M = 0;
     M = Data.clcMid();
     List<double> tVctr = new List<double>();
     tVctr = Data.get();
     for (int i = 0; i < tVctr.Count; i++)
     {
         tVctr[i] = tVctr[i] - M;
     }
     ZDM.set(tVctr);
     Tetta0 = 0;
     Tetta0 = M;
     //ZDM = Data;///
     if (D > 0)
     {
         Dif.set(ZDM);
         Dif.mkModel(D);
         ZDM = Dif.getA();
     }
     if (Ds > 0)
     {
         Dis.set(ZDM);
         Dis.setS(Ss);
         Dis.mkModel(Ds);
         ZDM = Dis.getA();
     }
     //---------------------------
     this.ACorr.set(ZDM, kASgm);
     this.PCorr.set(ZDM, kPSgm);
 }
Пример #19
0
        //-------------------------------------
        /// <summary>
        /// Частная автокорреляционная функция
        /// </summary>
        /// <param name="Fkk"></param>
        /// <returns></returns>
        public List<List<double>> clcPCorrelation(qData Fkk)
        {
            int size = 0;
            size = this.Vctr.Count;
            List<List<double>> F = new List<List<double>>(size);
            for (int i = 1; i < size; i++)
            {
                F[i] = new List<double>(i + 1);
            }
            F[0] = new List<double>(size);

            F[1][1] = Vctr[1];
            F[0][1] = F[1][1];
            for (int p = 1; p < size - 1; p++)
            {
                double S1 = 0;
                double S2 = 0;
                for (int j = 1; j <= p; j++)
                {
                    S1 = S1 + F[p][j] * Vctr[p + 1 - j];
                }
                for (int j = 1; j <= p; j++)
                {
                    S2 = S2 + F[p][j] * Vctr[j];
                }
                F[p + 1][p + 1] = (Vctr[p + 1] - S1) / (1 - S2);
                for (int j = 1; j <= p; j++)
                {
                    F[p + 1][j] = F[p][j] - F[p + 1][p + 1] * F[p][p + 1 - j];
                    S1 = F[p][j] - F[p + 1][p + 1] * F[p][p + 1 - j];
                }
                F[0][p + 1] = F[p + 1][p + 1];
            }
            List<double> tmp = F[0];
            qData tData = new qData(tmp);
            Fkk.set(tData);
            return F;
        }
Пример #20
0
 //-------------------------------------
 /// <summary>
 /// вычислит сезонную разность  
 /// </summary>
 /// <param name="s">s - порядок сезона</param>
 /// <param name="d">d - порядок разности</param>
 /// <returns></returns>
 public List<List<double>> clcDiffMatrix(int s, int d)
 {
     List<List<double>> tM = new List<List<double>>(d + 1);
     qData tData = new qData();
     tData = this;
     tM[0] = Vctr;
     for (int i = 1; i <= d; i++)
     {
         tData = tData.clcDiffSeason(s);
         tM[i] = tData.get();
     } // tData.difference().get();
     return tM;
 }
Пример #21
0
 //-------------------------------------
 public qData clcPCorrSgmMin(double k)
 {
     int size = 0;
     size = this.Vctr.Count;
     double value = -Math.Sqrt((double)(k) / (double)(size));
     //!!!!!!!!!!!111
     //List<double> tVctr = new List<double>(size,value); //результат
     List<double> tVctr = new List<double>(size);
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #22
0
 //-------------------------------------
 public qData clcDiffSeason(int s)
 {
     int size = this.Vctr.Count;
     List<double> tVctr = new List<double>(size);
     for (int i = s; i < size; i++)
     {
         tVctr[i] = Vctr[i] - Vctr[i - s];
     }
     for (int i = 0; i < s; i++)
     {
         tVctr[i] = Vctr[i];
     }
     qData tData = new qData();
     tData.set(tVctr);
     return tData;
 }
Пример #23
0
 public void set(qData aData)
 {
     this.Vctr = aData.get();
 }
Пример #24
0
 //-------------------------------------
 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;
     }
 }
Пример #25
0
 //-------------------------------------
 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;
 }
Пример #26
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;
 }
Пример #27
0
 //-------------------------------------
 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;
 }
Пример #28
0
 //-------------------------------------
 //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;
     }
 }
Пример #29
0
 //-------------------------------------
 //C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
 //ORIGINAL LINE: qData clcACovariation2() const
 private qData clcACovariation2()
 {
     List<double> tVctr = new List<double>(Vctr.Count); //вектор результата
     if (Vctr.Count != 0)
     {
         double M;
         M = this.clcMid();
         for (int k = 0; k != Vctr.Count - 1; k++) //по всем задержкам
         {
             double C = 0;
             C = this.clcACovariation2(k, M);
             tVctr[k] = C;
         }
     }
     qData tData = new qData(tVctr);
     return tData;
 }
Пример #30
0
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 public qData getTetta0()
 {
     List<double> tVctr = new List<double>();
     //List<double> tVctr = new List<double>(1, Tetta0);
     throw new System.NotImplementedException();
     qData tData = new qData(tVctr);
     return tData;
 }