public override String ToString() { StringBuilder buf = new StringBuilder(); String unknown = "Illegal operation or error: "; buf.Append("-----------------------------------------------------------------------------\n"); buf.Append("LUDecompositionQuick(A) --> isNonSingular(A), det(A), pivot, L, U, inverse(A)\n"); buf.Append("-----------------------------------------------------------------------------\n"); buf.Append("isNonSingular = "); try { buf.Append(this.IsNonsingular.ToString()); } catch (ArgumentException exc) { buf.Append(unknown + exc.Message); } buf.Append("\ndet = "); try { buf.Append(this.Det().ToString()); } catch (ArgumentException exc) { buf.Append(unknown + exc.Message); } buf.Append("\npivot = "); try { buf.Append((new IntArrayList(this.Pivot)).ToString()); } catch (ArgumentException exc) { buf.Append(unknown + exc.Message); } buf.Append("\n\nL = "); try { buf.Append(this.L.ToString()); } catch (ArgumentException exc) { buf.Append(unknown + exc.Message); } buf.Append("\n\nU = "); try { buf.Append(this.U.ToString()); } catch (ArgumentException exc) { buf.Append(unknown + exc.Message); } buf.Append("\n\ninverse(A) = "); DoubleMatrix2D identity = Cern.Colt.Matrix.DoubleFactory2D.Dense.Identity(LU.Rows); try { this.Solve(identity); buf.Append(identity.ToString()); } catch (ArgumentException exc) { buf.Append(unknown + exc.Message); } return(buf.ToString()); }
public void Demo2() { foreach (var f in new[] { DoubleFactory2D.Dense, DoubleFactory2D.Sparse }) { const DoubleMatrix2D N = null; DoubleMatrix2D a = f.Make(2, 2, 1); DoubleMatrix2D b = f.Make(4, 4, 2); DoubleMatrix2D c = f.Make(4, 3, 3); DoubleMatrix2D d = f.Make(2, 2, 4); var parts1 = new[] { new[] { N, a, N }, new[] { b, N, c }, new[] { N, d, N } }; DoubleMatrix2D matrix = f.Compose(parts1); var sm = matrix.ToString(); a.Assign(9); b.Assign(9); c.Assign(9); d.Assign(9); f.Decompose(parts1, matrix); var sa = a.ToString(); var sb = b.ToString(); var sc = c.ToString(); var sd = d.ToString(); } }