Esempio n. 1
0
        public static Matrix CalcSchurComplementFull(Matrix A, CscMatrix B, LdlSkyline inverseC)
        {
            // S = A - B^T * inv(C) * B
            Matrix invCB = Matrix.CreateZero(inverseC.Order, B.NumColumns);

            inverseC.SolveLinearSystems(B, invCB);
            return(A - B.MultiplyRight(invCB, true));
        }
        private static void TestMultipleSystemsSolution(/*LinearAlgebraProviderChoice providers*/)
        {
            //TestSettings.RunMultiproviderTest(providers, delegate () {
            //

            var skyline = SkylineMatrix.CreateFromArrays(SparsePosDef10by10.Order, SparsePosDef10by10.SkylineValues,
                                                         SparsePosDef10by10.SkylineDiagOffsets, true, true);
            LdlSkyline factor   = skyline.FactorLdl(false);
            var        identity = Matrix.CreateIdentity(SparsePosDef10by10.Order);
            var        inverse  = Matrix.CreateZero(SparsePosDef10by10.Order, SparsePosDef10by10.Order);

            factor.SolveLinearSystems(identity, inverse);

            var matrixTimesInverse = MatrixOperations.MatrixTimesMatrix(SparsePosDef10by10.Matrix, inverse.CopyToArray2D());

            comparer.AssertEqual(identity.CopyToArray2D(), matrixTimesInverse);

            //});
        }