using System; using System.Runtime.InteropServices; using System.Text; using NagLibrary; public class NagF02Functions { public static void Main() { int n = 4; int tdx = n; double[] x = { 0.5, 0.0, 2.3, -2.6, 0.0, 0.5, -1.4, -0.7, 2.3, -1.4, 0.5, 0.0, -2.6, -0.7, 0.0, 0.5 }; double[] r = new double[n]; nag_declarations.NagError fail = new nag_declarations.NagError(); fail.message = new byte[512]; Encoding enc = Encoding.ASCII; /* nag_real_symm_eigenvalues (f02aac). * All eigenvalues of real symmetric matrix */ nag_declarations.nag_real_symm_eigenvalues(n, x, tdx, r, ref fail); if (fail.code != 0) { Console.WriteLine("Error from nag_real_symm_eigenvalues (f02aac):"); Console.WriteLine(enc.GetString(fail.message)); } else { Console.WriteLine("Eigenvalues"); for (int i = 0; i < n; i++) Console.Write("{0, 9:f4}", r[i]); Console.WriteLine(); } } }