using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter02.Section7 { public class ExampleB { public ExampleB() { } private string result; public string Result { get { return result; } } public void Compute() { double[,] x = {{1.0,4.0,5.0}, {4.0,2.0,6.0}, {5.0,6.0,3.0}}; L.Matrix A = new L.Matrix(x); L.FactorizationPAeqLU obj = new L.FactorizationPAeqLU(A); obj.Compute(); result += obj.LowerTriangular.ToString(); result += obj.UpperTriangular.ToString(); result += obj.RowPermutation.ToString(); L.Matrix LU = obj.LowerTriangular * obj.UpperTriangular; result += LU.ToString(); L.Matrix PA = obj.RowPermutation * A; result += PA.ToString(); } } } /* 1 0 0 0.2 1 0 0.8 -1 1 5 6 3 0 2.8 4.4 0 0 8 0 0 1 1 0 0 0 1 0 5 6 3 1 4 5 4 2 6 5 6 3 1 4 5 4 2 6 */