using System; using System.Runtime.InteropServices; using NagCFunctionsAPI; public class NagG03Functions { public static void nag_mv_kmeans_cluster_analysis (int n, int m, double [,] x, int [] isx, int nvar, int k, double [,] cmeans, double [] wt, int [] inc, int [] nic, double [] css, double [] csw, int maxit, ref string error_message, ref int fail_code) { int tdx = m; int tdc = nvar; NagError fail = new NagError(); fail.char_array = new char [512]; // fail.print=1; NagFunctions.g03efc(n, m, x, tdx, isx, nvar, k, cmeans, tdc, wt, inc, nic, css, csw, maxit, ref fail); string tmpstring = new string(fail.char_array); error_message = tmpstring; fail_code = fail.code; } public static void Main() { int n=20; int m=5; int nvar=5; int k=3; int maxit=10; int fail_code=0; String error_message=""; double [,] x = { {77.3, 13.0, 9.7, 1.5, 6.4}, {82.5, 10.0, 7.5, 1.5, 6.5}, {66.9, 20.6, 12.5, 2.3, 7.0}, {47.2, 33.8, 19.0, 2.8, 5.8}, {65.3, 20.5, 14.2, 1.9, 6.9}, {83.3, 10.0, 6.7, 2.2, 7.0}, {81.6, 12.7, 5.7, 2.9, 6.7}, {47.8, 36.5, 15.7, 2.3, 7.2}, {48.6, 37.1, 14.3, 2.1, 7.2}, {61.6, 25.5, 12.9, 1.9, 7.3}, {58.6, 26.5, 14.9, 2.4, 6.7}, {69.3, 22.3, 8.4, 4.0, 7.0}, {61.8, 30.8, 7.4, 2.7, 6.4}, {67.7, 25.3, 7.0, 4.8, 7.3}, {57.2, 31.2, 11.6, 2.4, 6.5}, {67.2, 22.7, 10.1, 3.3, 6.2}, {59.2, 31.2, 9.6, 2.4, 6.0}, {80.2, 13.2, 6.6, 2.0, 5.8}, {82.2, 11.1, 6.7, 2.2, 7.2}, {69.7, 20.7, 9.6, 3.1, 5.9} }; double [,] cmeans = { {82.5, 10.0, 7.5, 1.5, 6.5}, {47.8, 36.5, 15.7, 2.3, 7.2}, {67.2, 22.7, 10.1, 3.3, 6.2} }; double [] wt = new double[n]; for (int i=0; i