using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter02.Section2 { public class ExampleA { public ExampleA() { } private string result; public string Result { get { return result; } } public void Compute() { double[,] x = {{3.0,1.0,0.0}, {6.0,9.0,2.0}, {0.0,1.0,5.0}}; L.Matrix A = new L.Matrix(x); L.FactorizationPAeqLU obj = new L.FactorizationPAeqLU(A); obj.Compute(); L.Matrix LU = obj.LowerTriangular * obj.UpperTriangular; L.Matrix PA = obj.RowPermutation * A; result += PA.ToString() + "\r\n"; result += LU.ToString() + "\r\n"; result += obj.LowerTriangular.ToString() + "\r\n"; result += obj.UpperTriangular.ToString() + "\r\n"; } } } /* 3 1 0 6 9 2 0 1 5 3 1 0 6 9 2 0 1 5 1 0 0 2 1 0 0 0.142857142857143 1 3 1 0 0 7 2 0 0 4.71428571428571 */