示例#1
0
        public static int Main(string[] args)
        {
            var a = new NumericMatrix<int>(3, 3);
            a[0][0] = 101;
            a[0][1] = -102;
            a[0][2] = 103;

            a[1][0] = 201;
            a[1][1] = 202;
            a[1][2] = 203;

            a[2][0] = 301;
            a[2][1] = -302;
            a[2][2] = 303;

            Console.WriteLine("a: {0}; |a|: {1}", a, a.Det());
            var b = a.Transposed().MultiplyBy(2);
            Console.WriteLine("b: {0}; |b|: {1}", b, b.Det());

            return 0;
        }
示例#2
0
        public static int Main(string[] args)
        {
            var a = new NumericMatrix<double>(2, 3);
            a[0][0] = 1.5;
            a[0][1] = 2.5;
            a[0][2] = 3.5;

            a[1][0] = 3.5;
            a[1][1] = 2.5;
            a[1][2] = 1.5;

            var b = new NumericMatrix<double>(3, 4);

            b[0][0] = 1.5;
            b[0][1] = 2.5;
            b[0][2] = 3.5;
            b[0][3] = 4.5;

            b[1][0] = 4.5;
            b[1][1] = 3.5;
            b[1][2] = 2.5;
            b[1][3] = 1.5;

            b[2][0] = 5.5;
            b[2][1] = 6.5;
            b[2][2] = 7.5;
            b[2][3] = 8.5;

            Console.WriteLine("a: {0}\nb: {1}", a, b);
            Console.WriteLine("a.b is okay as of a: {0}", a.IsCompatibleBeingLeft(b));
            Console.WriteLine("b.a is okay as of a: {0}", a.IsCompatibleBeingRight(b));
            Console.WriteLine("a.b is okay as of b: {0}", b.IsCompatibleBeingRight(a));
            Console.WriteLine("b.a is okay as of b: {0}", b.IsCompatibleBeingLeft(a));

            var ab = a.MultiplyBy(b);
            Console.WriteLine("a.b: {0}", ab );
            var abt = a.Transposed();
            Console.WriteLine("a.b^t: {0}", abt );
            return 0;
        }