// f01vh Example Program Text // C# version, NAG Copyright 2012 using System; using NagLibrary; namespace NagDotNetExamples { public class F01VHE { static string datafile = "ExampleData/f01vhe.d"; // Specify data file as a command line argument. // It defaults to the named file specified below otherwise. static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { DataReader sr = new DataReader(datafile); // f01vh Example Program Text // Mark 25 Release. NAG Copyright 2013. int inc1 = 1, indent = 0, ncols = 80; string brac = "B", diag = "N", intlabel = "I", matrix = "G", nolabel = "N"; string form = "F5.2"; int ifail = 0, info = 0, lda = 0, lenarf = 0, n = 0; string title = ""; string transr = "", uplo = ""; Complex[,] a; Complex[] arf; string[] clabs = new string[1]; string[] rlabs = new string[1]; Console.WriteLine(" {0}", "F01VHF Example Program Results"); // Skip heading in data file sr.Reset(); Console.WriteLine(""); sr.Reset(); n = int.Parse(sr.Next()); uplo = sr.Next(); transr = sr.Next(); lda = (int)n; lenarf = n * (n + 1) / 2; arf = new Complex[lenarf]; a = new Complex[lda, n]; // allocate // Read an RFP matrix into array ARF sr.Reset(); for (int i = 1; i <= lenarf; i++) { arf[i-1] = Complex.Parse(sr.Next()); } // Print the Rectangular Full Packed array title = "RFP Packed Array ARF:"; ifail = 0; X04.x04db(matrix, diag, lenarf, inc1, arf, brac, form, title, intlabel, rlabs, nolabel, clabs, ncols, indent, out ifail); Console.WriteLine(""); // Convert to triangular form info = 0; // The NAG name equivalent of ztfttr is f01vhf F01.f01vh(transr, uplo, n, arf, a, out info); // Print the unpacked array title = "Unpacked Matrix A: "; ifail = 0; X04.x04db(uplo, diag, n, n, a, brac, form, title, intlabel, rlabs, intlabel, clabs, ncols, indent, out ifail); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Exception Raised"); } } } }