// f07tj Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; namespace NagDotNetExamples { public class F07TJE { static string datafile = "ExampleData/f07tje.d"; const string diag="N"; 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, info, j, n; string uplo=""; int ifail; Console.WriteLine("f07tj Example Program Results"); // Skip heading in data file sr.Reset(); sr.Reset(); n = int.Parse(sr.Next()); double[,] a = new double[n, n]; if (n > 0) { // // Read A from data file // sr.Reset(); uplo = sr.Next(); if (uplo == "U") { sr.Reset(); for (i = 1 ; i <= n ; i++) { for (j = i ; j <= n ; j++) { a[i - 1 , j - 1] = double.Parse(sr.Next(), CultureInfo.InvariantCulture); } } } else if (uplo == "L") { sr.Reset(); for (i = 1 ; i <= n ; i++) { for (j = 1 ; j <= i ; j++) { a[i - 1 , j - 1] = double.Parse(sr.Next(), CultureInfo.InvariantCulture); } } } // // Compute inverse of A // F07.f07tj(uplo, diag, n, a, out info); if (info < 0) { return; } // // Print inverse // if (info >= 0) { Console.WriteLine(""); X04.x04ca(uplo, diag, n, n, a, "Inverse", out ifail); } } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Exception Raised"); } } } }