// c06gq Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; namespace NagDotNetExamples { public class C06GQE { static string datafile = "ExampleData/c06gqe.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { DataReader sr = new DataReader(datafile); int i, j, m, n; int ifail; Console.WriteLine("c06gq Example Program Results"); // Skip heading in data file sr.Reset(); try { while (true) { sr.Reset(); m = int.Parse(sr.Next()); n = int.Parse(sr.Next()); if (m >= 1 && n >=1) { double[] u = new double[m*n]; double[] v = new double[m*n]; double[] x = new double[m*n]; 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.InvariantCulture); } } 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++) { Console.Write(" {0, 10:f4}", 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, out ifail); // if (ifail == 0) { for (j = 1 ; j <= m ; j++) { Console.WriteLine(""); Console.Write(" {0}", "Real "); for (i = 0 ; i <= n - 1 ; i++) { Console.Write(" {0, 10:f4}", u[i * m + j - 1]); } Console.WriteLine(); Console.Write(" {0}", "Imag "); for (i = 0 ; i <= n - 1 ; i++) { Console.Write(" {0, 10:f4}", v[i * m + j - 1]); } Console.WriteLine(); } // C06.c06gq(m, n, x, out ifail); // Console.WriteLine(""); Console.WriteLine(" {0}","Conjugated data values"); Console.WriteLine(""); for (j = 1 ; j <= m ; j++) { Console.Write(" {0}", ""); for (i = 0 ; i <= n - 1 ; i++) { Console.Write(" {0, 10:f4}", x[i * m + j - 1]); } Console.WriteLine(); } // C06.c06gs(m, n, x, u, v, out ifail); // Console.WriteLine(""); Console.WriteLine(" {0}","Conjugated data written in full complex form"); // C06.c06gs(m, n, x, u, v, out ifail); // for (j = 1 ; j <= m ; j++) { Console.WriteLine(""); Console.Write(" {0}", "Real "); for (i = 0 ; i <= n - 1 ; i++) { Console.Write(" {0, 10:f4}", u[i * m + j - 1]); } Console.WriteLine(); Console.Write(" {0}", "Imag "); for (i = 0 ; i <= n - 1 ; i++) { Console.Write(" {0, 10:f4}", v[i * m + j - 1]); } Console.WriteLine(); } } else { Console.WriteLine(""); Console.WriteLine(" ** c06gs returned with ifail = {0, 3}", ifail); } } else { Console.WriteLine(" {0}","Invalid value of M or N"); } } } catch { } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Exception Raised"); } } } }