示例#1
0
        static void Main(string[] args)
        {
            //Declare a 4x4 matrix
            Matrix44 <double> m44 = new Matrix44 <double>(6, -7, 10, 4, 0, 3, -1, 8, 0, 5, -7, 0, 1, 2, 7, 6);
            //Declare an identity matrix
            Matrix44 <double> id4 = Matrix44 <double> .Identity(1.0);

            Console.WriteLine(m44);
            Matrix44 <double> d = m44.Inverse(1.0);

            Console.WriteLine("\n" + d * m44);
            Console.WriteLine(m44 * id4 == m44); //True
            Console.WriteLine(id4 * m44 == m44); //True

            //Declare a 3x3 matrix
            Matrix33 <double> m33 = new Matrix33 <double>(6, -7, 10, 0, 3, -1, 0, 5, 2);

            Matrix33 <double> m33Inv = m33.Inverse(1.0);
            Matrix33 <double> c      = m33 * m33Inv;

            Console.WriteLine("\n" + c);                              //True

            Console.WriteLine(c == Matrix33 <double> .Identity(1.0)); //True
            Console.WriteLine(m44);                                   //True

            Console.ReadKey();
        }
示例#2
0
        public void MatrixComplex()
        {
            var i = Complex.ImaginaryOne;

            //Declare a 4x4 matrix
            Matrix44 <Complex> m44 = new Matrix44 <Complex>(1, 1, 1, 1, 1, i, -1, -i, 1, -i, 1, -1, 1, -i, -1, i);

            //Declare an identity matrix
            Matrix44 <Complex> id = Matrix44 <Complex> .Identity(1);

            System.Diagnostics.Debug.WriteLine(id * m44 == m44);//true

            //Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            var i = Complex.ImaginaryOne;

            //Declare a 4x4 matrix
            Matrix44 <Complex> m44 = new Matrix44 <Complex>(1, 1, 1, 1, 1, i, -1, -i, 1, -i, 1, -1, 1, -i, -1, i);

            //Declare an identity matrix
            Matrix44 <Complex> id = Matrix44 <Complex> .Identity(1.0);

            Console.WriteLine(id * m44 == m44);//true

            Console.ReadKey();
        }
示例#4
0
        public void MatrixReal()
        {
            //Declare a 4x4 matrix
            Matrix44 <float> m44 = new Matrix44 <float>(6, -7, 10, 4, 0, 3, -1, 8, 0, 5, -7, 0, 1, 2, 7, 6);
            //Declare an identity matrix
            Matrix44 <float> id = Matrix44 <float> .Identity(1);

            System.Diagnostics.Debug.WriteLine(m44 * id == m44); //True
            System.Diagnostics.Debug.WriteLine(id * m44 == m44); //True

            //Declare a 3x3 matrix
            Matrix33 <float> m33 = new Matrix33 <float>(6, -7, 10, 0, 3, -1, 0, 5, -7);

            Matrix33 <float> m33Inv = m33.Inverse(1);
            Matrix33 <float> id2    = m33 * m33Inv;

            System.Diagnostics.Debug.WriteLine(id2 == Matrix33 <float> .Identity(1)); //True

            //Console.ReadKey();
        }