private static void TestMinNormSolution(LinearAlgebraProviderChoice providers) { TestSettings.RunMultiproviderTest(providers, delegate() { var A = Matrix.CreateFromArray(RectangularFullRank10by5.Matrix).Transpose(); var b = Vector.CreateFromArray(RectangularFullRank10by5.RhsMinNorm); var xExpected = Vector.CreateFromArray(RectangularFullRank10by5.LhsMinNorm); LQFactorization factorization = A.FactorLQ(); Vector xComputed = factorization.SolveMinNorm(b); comparer.AssertEqual(xExpected, xComputed); }); }
private static void TestFactorsLQ(LinearAlgebraProviderChoice providers) { TestSettings.RunMultiproviderTest(providers, delegate() { var A = Matrix.CreateFromArray(RectangularFullRank10by5.Matrix).Transpose(); Matrix expectedL = Matrix.CreateFromArray(RectangularFullRank10by5.LQFactorL); Matrix expectedQ = Matrix.CreateFromArray(RectangularFullRank10by5.LQFactorQ); LQFactorization factorization = A.FactorLQ(); Matrix computedL = factorization.GetFactorL(); Matrix computedQ = factorization.GetFactorQ(); comparer.AssertEqual(expectedL, computedL); comparer.AssertEqual(expectedQ, computedQ); }); }