static void Main(string[] args)
        {
            //Reader.CacheAdd("2 4 2 = 4 2 2 = 2 2 -1 = 1 0 1"); //skriptovy priklad
            //Reader.CacheAdd("-5 4 1 / -7 6 1 / 4 -4 -2 / 1 2 1");
            Reader.CacheAdd("0 0 0.33333333 0 0 0 / 0.5 0 0.3333333 0 0 0 / 0.5 0 0 0 0 0.5 / 0 0 0 0 0 0.5 / 0 1 0.3333333 0.5 0 0 / 0 0 0 0.5 1 0 / 1 0 1 0 1 0 ");
            int N = 6;

            A = new double[N, N];
            for (int i = 0; i < N*N; i++)
                A[i % N, i / N] = Reader.ReadDouble();

            double[] pom = new double[N];
            for (int i = 0; i < N; i++)
                pom[i] = Reader.ReadDouble();

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

            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;
            }
        }
        static void Main(string[] args)
        {
            Reader.CacheAdd("2 4 2 = 4 2 2 = 2 2 -1 = 1 0 1"); //skriptovy priklad
            //Reader.CacheAdd("-5 4 1 / -7 6 1 / 4 -4 -2 / 1 2 1");

            A = new int[3, 3];
            for (int i = 0; i < 9; i++)
                A[i % 3, i / 3] = Reader.ReadInt();

            double[] pom = new double[3];
            for (int i = 0; i < 3; i++)
                pom[i] = Reader.ReadInt();

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

            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;
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            //Reader.CacheAdd("2 4 2 = 4 2 2 = 2 2 -1 = 1 0 1"); //skriptovy priklad
            //Reader.CacheAdd("-5 4 1 / -7 6 1 / 4 -4 -2 / 1 2 1");
            Reader.CacheAdd("0 0 0.33333333 0 0 0 / 0.5 0 0.3333333 0 0 0 / 0.5 0 0 0 0 0.5 / 0 0 0 0 0 0.5 / 0 1 0.3333333 0.5 0 0 / 0 0 0 0.5 1 0 / 1 0 1 0 1 0 ");
            int N = 6;

            A = new double[N, N];
            for (int i = 0; i < N * N; i++)
            {
                A[i % N, i / N] = Reader.ReadDouble();
            }

            double[] pom = new double[N];
            for (int i = 0; i < N; i++)
            {
                pom[i] = Reader.ReadDouble();
            }

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

            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;
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Reader.CacheAdd("2 4 2 = 4 2 2 = 2 2 -1 = 1 0 1"); //skriptovy priklad
            //Reader.CacheAdd("-5 4 1 / -7 6 1 / 4 -4 -2 / 1 2 1");

            A = new int[3, 3];
            for (int i = 0; i < 9; i++)
            {
                A[i % 3, i / 3] = Reader.ReadInt();
            }

            double[] pom = new double[3];
            for (int i = 0; i < 3; i++)
            {
                pom[i] = Reader.ReadInt();
            }

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

            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;
            }
        }