public static void SubMatrixExtractionWithCoupling( [Values(XDGusage.none, XDGusage.all)] XDGusage UseXdg, [Values(2)] int DGOrder, [Values(MatrixShape.diagonal, MatrixShape.diagonal_var, MatrixShape.full_spec, MatrixShape.full_var_spec)] MatrixShape MShape ) { Utils.TestInit((int)UseXdg, DGOrder, (int)MShape); Console.WriteLine("ExtractSubMatrixAndIgnoreCoupling({0},{1},{2})", UseXdg, DGOrder, MShape); //Arrange --- get multigridoperator MultigridOperator MGOp = Utils.CreateTestMGOperator(UseXdg, DGOrder, MShape); BlockMsrMatrix M = MGOp.OperatorMatrix; MultigridMapping map = MGOp.Mapping; //Arrange --- setup masking SubBlockSelector SBS = new SubBlockSelector(map); BlockMask mask = new BlockMask(SBS, null); bool[] coup = Utils.SetCoupling(MShape); //Arrange --- some time measurement Stopwatch stw = new Stopwatch(); stw.Reset(); //Act --- establish submatrix stw.Start(); //var Ones = M.CloneAs(); //Ones.Clear(); //Ones.SetAll(1); //var extractOnes = mask.GetSubBlockMatrix(Ones, false, coup[0], coup[1]); var Mext = mask.GetSubBlockMatrix(M, false, coup[0], coup[1]); stw.Stop(); var Mquad = M.ConvertToQuadraticBMsr(mask.GlobalIList_Internal.ToArray(), true); Mext.Acc(-1.0, Mquad); //Assert --- Mext conains only diagonal blocks of M Assert.IsTrue(Mext.InfNorm() == 0); }