// f01fc Example Program Text // C# version, NAG Copyright 2012 using System; using NagLibrary; namespace NagDotNetExamples { public class F01FCE { // Specify data file as a command line argument. // It defaults to the named file specified below otherwise. static string datafile = "ExampleData/f01fce.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { DataReader sr = new DataReader(datafile); // f01fc Example Program Text // Mark 25 Release. NAG Copyright 2013. int i = 0, ierr = 0, ifail = 0, lda = 0, n = 0; Console.WriteLine(" {0}", "F01FCF Example Program Results"); Console.WriteLine(""); // Skip heading in data file sr.Reset(); sr.Reset(); n = int.Parse(sr.Next()); int j = 0; lda = (int)n; Complex[,] a = new Complex[lda, n]; // allocate // Read A from data file sr.Reset(); for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { a[i - 1, j - 1] = Complex.Parse(sr.Next()); } } // ifail: behaviour on error exit // =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0; // Find exp( A ) F01.f01fc(n, a, out ifail); // Print solution ierr = 0; X04.x04da("General", "", n, n, a, "Exp(A)", out ierr); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Exception Raised"); } } } }