コード例 #1
0
        public Vektor CalculatePageRank(double[,] A)
        {
            double[] pom = new double[A.GetLength(0)];
            for (int i = 0; i < pom.Length; i++)
            {
                pom[i] = 1;
            }

            Vektor x     = new Vektor(pom);
            Vektor xprev = x;
            Vektor y;

            ////Console.WriteLine(x.pole.Length);
            //Console.WriteLine(A.GetLength(0));
            //Console.Write("{0} : (", 0); x.Vypis(); Console.Write(") -"); Console.WriteLine();

            for (int i = 0; i < 20; i++)
            {
                y = Pocitej.NasobeniMaticeVektorem(A, x);
                x = y.Clone();
                Pocitej.JednotkovaVelikost(x);

                //Console.Write("{0} : (", i + 1);
                //x.Vypis();
                //Console.Write(") {0}", String.Format("{0:0.###}", Pocitej.SkalarniSoucin(xprev, y)));
                //Console.WriteLine();

                xprev = x;
            }
            return(x);
        }
コード例 #2
0
 public double AbsolutValue()
 {
     return(Math.Sqrt(Pocitej.SkalarniSoucin(this, this)));
 }