Esempio n. 1
0
        private void GetMarkovHao(int k)
        {
            act(0, "\r\n\t正在计算MarkovHao\r\n\t......\r\n");
            Stopwatch sp = new Stopwatch();

            sp.Start();

            foreach (KeyValuePair <string, Dictionary <int, List <int> > > item in dicKtuple)
            {
                MarkovPossibilityHao m = new MarkovPossibilityHao(item.Value, dicTotal[item.Key]);
                //dicMarkovHao.Add(item.Key, new Dictionary<int, List<double>>());
                //Parallel.For(0, ListK.Count, (i) =>
                //{
                //if (k > 2)
                //{
                Dictionary <int, List <double> > dic = dicMarkovHao[item.Key];
                //dicMarkovHao[item.Key].Add(k, m.GetMarkovPossibility(k));
                dic.Add(k, m.GetMarkovPossibility(k));
                act(1, "");
                //}//if
                //});
            }//foreach

            sp.Stop();
            act(0, "\tk = " + k + " 计算完毕,用时 " + sp.ElapsedMilliseconds * 1.0 / 1000 + " s\r\n\r\n");
        }
Esempio n. 2
0
        private void GetMarkovHao()
        {
            act(0, "\r\n\t正在计算MarkovHao\r\n\t......\r\n");
            Stopwatch sp = new Stopwatch();

            sp.Start();

            foreach (KeyValuePair <string, Dictionary <int, List <int> > > item in dicKtuple)
            {
                MarkovPossibilityHao m = new MarkovPossibilityHao(item.Value, dicTotal[item.Key]);
                dicMarkovHao.Add(item.Key, new Dictionary <int, List <double> >());
                Parallel.For(0, ListK.Count, (i) =>
                {
                    if (ListK[i] > 2)
                    {
                        dicMarkovHao[item.Key].Add(listK[i], m.GetMarkovPossibility(ListK[i]));
                        act(1, "");
                    } //if
                });
            }         //foreach

            sp.Stop();
            act(0, "\t计算完毕,用时 " + sp.ElapsedMilliseconds * 1.0 / 1000 + " s\r\n\r\n");
        }