// c06gs Example Program Text // Mark 14 Revised. NAG Copyright 1989. // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; namespace NagDotNetExamples { public class C06gsfe { const int mmax=5; const int nmax=20; const int nin=5; public static int Main (string[] args) { DataReader sr = new DataReader("ExampleData/c06gsfe.d"); int i=0, j=0, m=0, n=0; double[] u = new double[100]; double[] v = new double[100]; double[] x = new double[100]; int ifail; Console.WriteLine("c06gs Example Program Results"); // Skip heading in data file sr.Reset(); L20: ; try { sr.Reset(); m = int.Parse(sr.Next()); n = int.Parse(sr.Next()); } catch { goto L100; } if ((m <= mmax) && (n <= nmax)) { for (j = 1 ; j <= m ; j++) { sr.Reset(); for (i = 0 ; i <= n - 1 ; i++) { x[i * m + j - 1] = double.Parse(sr.Next(), CultureInfo.CurrentCulture); } } Console.WriteLine(""); Console.WriteLine(" {0}","Original data values"); Console.WriteLine(""); for (j = 1 ; j <= m ; j++) { Console.Write(" {0}", ""); for (i = 0 ; i <= n - 1 ; i++) { // nested do in write Console.Write(" {0}", x[i * m + j - 1]); } Console.WriteLine(); } Console.WriteLine(""); Console.WriteLine(" {0}","Original data written in full complex form"); // C06.c06gs(m, n, x, u, v, ref ifail); // if (ifail == 0) { for (j = 1 ; j <= m ; j++) { Console.WriteLine(""); Console.Write(" {0}", "Real "); for (i = 0 ; i <= n - 1 ; i++) { // nested do in write Console.Write(" {0}", u[i * m + j - 1]); } Console.WriteLine(); Console.Write(" {0}", "Imag "); for (i = 0 ; i <= n - 1 ; i++) { // nested do in write Console.Write(" {0}", v[i * m + j - 1]); } Console.WriteLine(); } goto L20; } else { Console.WriteLine(""); Console.WriteLine(" {0}{1,5}"," ** c06gs returned with ifail = ",ifail); } } else { Console.WriteLine(" {0}","Invalid value of M or N"); } L100: ; // return 0; } } }