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