// g01dc Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01DCE { static void Main(String[] args) { StartExample(); } public static void StartExample() { try { const int n = 6; double errest, etol, exp1, exp2, sumssq; int i, j, k; double[] pp = new double[n]; double[] vec = new double[n*(n+1)/2]; int ifail; Console.WriteLine("g01dc Example Program Results"); etol = 0.00010e0; // G01.g01da(n, pp, etol, out errest, out ifail); // if (ifail == 0) { exp1 = pp[n - 1]; exp2 = pp[n - 2]; sumssq = 0.00e0; for (i = 1; i <= n; i++) { sumssq = sumssq + pp[i - 1] * pp[i - 1]; } // G01.g01dc(n, exp1, exp2, sumssq, vec, out ifail); // if (ifail == 0) { Console.WriteLine(""); Console.WriteLine(" {0}{1,2}", "Sample size = ", n); Console.WriteLine(" {0}", "Variance-covariance matrix"); k = 1; for (j = 1; j <= n; j++) { for (i = k; i <= k + j - 1; i++) { Console.Write(" {0,5:f4}", vec[i - 1]); } Console.WriteLine(""); k = k + j; } } else { Console.WriteLine(""); Console.WriteLine("** g01dc failed with ifail = {0,5}", ifail); } } else { Console.WriteLine(""); Console.WriteLine("** g01da failed with ifail = {0,5}", ifail); } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }