Ejemplo n.º 1
0
        private static void LinAlg()
        {
            int[,] ints = new int[2, 5];

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    ints[i, j] = 2;
                }
            }

            // A matrix with only 2's in it
            RealMatrix m = new RealMatrix(ints);

            RealMatrix n = new RealMatrix(5, 3)
            {
                Indices = new Real[, ] {
                    { 2, 3, 7 }, { 0, 0, 0 }, { 2, 4, 6 }, { -1, 4, 5 }, { 0, 8, 3 }
                }
            };

            RealMatrix p = m * n;

            Console.WriteLine(p[VectorType.Column]);

            RealMatrix e = n.ToReducedEchelonForm().ToRealMatrix();

            RealMatrix u = n * n.Transpose().ToRealMatrix();

            Console.WriteLine(e.IsReducedEchelon());
            Console.WriteLine();
            Console.WriteLine(u.ToDeterminant(3, true));
            Console.WriteLine();
            Console.WriteLine(u.Transpose().ToTable(3));
            Console.WriteLine(u.IsSymmetric());
            Console.WriteLine();
            Console.WriteLine("The matrix e, in all its glory: \n" + e.ToTable(3));
            Console.WriteLine(n);
        }