Beispiel #1
0
        public void 部分行列確認その2()
        {
            var mat = new MatrixLib.Matrix(3, 3);

            mat[0, 0] = 1;
            mat[0, 1] = 2;
            mat[0, 2] = 3;

            mat[1, 0] = 4;
            mat[1, 1] = 5;
            mat[1, 2] = 6;

            mat[2, 0] = 7;
            mat[2, 1] = 8;
            mat[2, 2] = 9;

            var subMat = new SubMatrix(mat, 1, 1, 2, 2);

            subMat[0, 0] = -1;
            subMat[0, 1] = -2;
            subMat[1, 0] = -3;
            subMat[1, 1] = -4;

            Console.WriteLine(mat.ToString());
            Console.WriteLine(mat.RowCount + " x " + mat.ColCount);
            Console.WriteLine("===================");
            Console.WriteLine(subMat.ToString());
            Console.WriteLine(subMat.RowCount + " x " + subMat.ColCount);

            Console.WriteLine("===================");

            subMat = new SubMatrix(subMat, 1, 1, 1, 1);
            Console.WriteLine(subMat.ToString());
            Console.WriteLine(subMat.RowCount + " x " + subMat.ColCount);
        }
Beispiel #2
0
        public void SubMatTest3()
        {
            var mat = new MatrixLib.Matrix(4, 4);

            mat[0, 0] = 1;
            mat[0, 1] = 2;
            mat[0, 2] = 3;
            mat[0, 3] = 4;


            mat[1, 0] = 5;
            mat[1, 1] = 6;
            mat[1, 2] = 7;
            mat[1, 3] = 8;

            mat[2, 0] = 9;
            mat[2, 1] = 10;
            mat[2, 2] = 11;
            mat[2, 3] = 12;

            mat[3, 0] = 13;
            mat[3, 1] = 14;
            mat[3, 2] = 15;
            mat[3, 3] = 16;

            var subMat = new SubMatrix(mat, 1, 1, 3, 3);

            subMat[0, 0] = -1;
            subMat[0, 1] = -2;
            subMat[1, 0] = -3;
            subMat[1, 1] = -4;

            Console.WriteLine(mat.ToString());
            Console.WriteLine(mat.RowCount + " x " + mat.ColCount);

            Console.WriteLine("===================");
            Console.WriteLine(subMat.ToString());
            Console.WriteLine(subMat.RowCount + " x " + subMat.ColCount);

            Console.WriteLine("===================");

            subMat = new SubMatrix(subMat, 1, 1, 2, 2);
            Console.WriteLine(subMat.ToString());
            Console.WriteLine(subMat.RowCount + " x " + subMat.ColCount);
        }