public void UntileMatrixTest()
        {
            var btm = new TiledBlockTridiagonalMatrix<double>(1);
            var bm11 = new Matrix<Matrix<double>>(2, 2);

            var block11 = new Matrix<double>(4, 4, (i, j) => i + j * 4);
            var block21 = new Matrix<double>(10, 4, (i, j) => i + 50 + j * 4);

            bm11[1, 1] = block11;
            bm11[2, 1] = block21;

            var block12 = new Matrix<double>(4, 42, (i, j) => i + 150 + j * 4);
            var block22 = new Matrix<double>(10, 42, (i, j) => i + 450 + j * 4);

            bm11[1, 2] = block12;
            bm11[2, 2] = block22;

            btm[1, 1] = bm11;

            var res = btm.Untile();
            var actual = res[1, 1];
            var expected = new Matrix<double>(block11.Rows + block21.Rows, block11.Columns + block12.Columns);
            expected.InsertMatrix(block11, 1, 1);
            expected.InsertMatrix(block12, 1, block11.Rows + 1);
            expected.InsertMatrix(block21, block11.Columns + 1, 1);
            expected.InsertMatrix(block22, block11.Columns + 1, block11.Rows + 1);

            Assert.AreEqual(expected.Rows, actual.Rows);
            Assert.AreEqual(expected.Columns, actual.Columns);

            for (int i = 1; i <= expected.Rows; i++)
            {
                for (int j = 1; j <= expected.Columns; j++)
                {
                    Assert.AreEqual(expected[i, j], actual[i, j], string.Format("i = {0}, j = {1}", i, j));
                }
            }
        }
        public void InsertMatrixTest()
        {
            var m1 = new Matrix<double>(new double[,]
                                       {
                                           {15, -93, -89, 34, -81, -14, 11, 90, -79, -85},
                                           {-58, 12, 95, -55, 11, 37, 61, -41, 75, -85},
                                           {75, 82, 77, 54, -76, -97, 28, -79, -85, 19},
                                           {-31, -4, -84, 79, 82, -92, -48, 9, -19, 25},
                                           {-30, 14, -63, -99, -29, 73, -63, 45, 57, 17},
                                           {-50, 78, 96, -32, 29, 44, 27, -10, 83, 81},
                                           {98, -75, 69, -9, 35, 92, 58, -5, -45, 89},
                                           {5, -3, 72, 69, -70, 73, 2, 47, 68, 92},
                                           {-23, 19, 42, 31, -43, -39, 54, -54, 58, -2},
                                           {19, 69, 55, -66, -23, 62, 47, -72, -43, -46}
                                       });
            var m2 = new Matrix<double>(new double[,] { { -30, 14, -63, -99, -29 }, { -50, 78, 96, -32, 29 }, { 98, -75, 69, -9, 35 } });

            m1.InsertMatrix(m2, 8, 3);

            var expected = new Matrix<double>(new double[,]
                                       {
                                           {15, -93, -89, 34, -81, -14, 11, 90, -79, -85},
                                           {-58, 12, 95, -55, 11, 37, 61, -41, 75, -85},
                                           {75, 82, 77, 54, -76, -97, 28, -79, -85, 19},
                                           {-31, -4, -84, 79, 82, -92, -48, 9, -19, 25},
                                           {-30, 14, -63, -99, -29, 73, -63, 45, 57, 17},
                                           {-50, 78, 96, -32, 29, 44, 27, -10, 83, 81},
                                           {98, -75, 69, -9, 35, 92, 58, -5, -45, 89},
                                           {5, -3, -30, 14, -63, -99, -29, 47, 68, 92},
                                           {-23, 19, -50, 78, 96, -32, 29, -54, 58, -2},
                                           {19, 69, 98, -75, 69, -9, 35, -72, -43, -46}
                                       });

            MatrixHelpers.Compare(expected, m1);
        }