예제 #1
0
    private static void test01(ref int seed)
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST01 tests LATIN_EDGE.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    01 March 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const int DIM_NUM   = 2;
        const int POINT_NUM = 10;

        Console.WriteLine();
        Console.WriteLine("TEST01");
        Console.WriteLine("  LATIN_EDGE chooses a Latin cell arrangement,");
        Console.WriteLine("  which includes the edge points.");
        Console.WriteLine();
        Console.WriteLine("  Spatial dimension = " + DIM_NUM);
        Console.WriteLine("  Number of points =  " + POINT_NUM);
        Console.WriteLine("  Initial seed for UNIFORM = " + seed);

        double[] x = LatinVariants.latin_edge(DIM_NUM, POINT_NUM, ref seed);

        Console.WriteLine();
        Console.WriteLine("  The Latin Edge Square points:");
        Console.WriteLine();

        int k = 0;

        for (int j = 0; j < POINT_NUM; j++)
        {
            int    kk   = k;
            string cout = "";
            for (int i = 0; i < DIM_NUM; i++)
            {
                cout += x[kk].ToString("0.########").PadLeft(10) + "  ";
                kk   += POINT_NUM;
            }
            Console.WriteLine(cout);
            k += 1;
        }
    }
예제 #2
0
    private static void Main(string[] args)
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    MAIN is the main program for LATIN_EDGE_DATASET.
    //
    //  Discussion:
    //
    //    LATIN_EDGE_DATASET generates a Latin Edge Square dataset
    //    and writes it to a file.
    //
    //  Usage:
    //
    //    latin_center_dataset m n seed
    //
    //    where
    //
    //    * M, the spatial dimension,
    //    * N, the number of points to generate,
    //    * SEED, the seed, a positive integer.
    //
    //    creates an M by N Latin Edge Square dataset and writes it to the
    //    file "latin_edge_M_N.txt".
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    15 December 2009
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int m;
        int n;
        int seed;


        Console.WriteLine("");
        Console.WriteLine("LATIN_EDGE_DATASET");
        Console.WriteLine("");
        Console.WriteLine("  Generate a Latin Edge Square dataset.");
        //
        //  Get the spatial dimension.
        //
        try
        {
            m = Convert.ToInt32(args[0]);
        }
        catch
        {
            Console.WriteLine("");
            Console.WriteLine("  Enter the value of M");
            m = Convert.ToInt32(Console.ReadLine());
        }

        Console.WriteLine("");
        Console.WriteLine("  Spatial dimension M = " + m + "");
        //
        //  Get the number of points.
        //
        try
        {
            n = Convert.ToInt32(args[1]);
        }
        catch
        {
            Console.WriteLine("");
            Console.WriteLine("  Enter the number of points N");
            n = Convert.ToInt32(Console.ReadLine());
        }

        Console.WriteLine("  Number of points N = " + n + "");
        //
        //  Get the seed.
        //
        try
        {
            seed = Convert.ToInt32(args[2]);
        }
        catch
        {
            Console.WriteLine("");
            Console.WriteLine("  Enter the value of SEED");
            seed = Convert.ToInt32(Console.ReadLine());
        }

        Console.WriteLine("  The seed is = " + seed + "");
        //
        //  Compute the data.
        //
        double[] r = new double[m * n];

        r = LatinVariants.latin_edge(m, n, ref seed);
        //
        //  Write it to a file.
        //

        string output_filename = "latin_edge_" + m + "_"
                                 + n + ".txt";

        typeMethods.r8mat_write(output_filename, m, n, r);

        Console.WriteLine("");
        Console.WriteLine("  The data was written to the file \""
                          + output_filename + "\".");

        Console.WriteLine("");
        Console.WriteLine("LATIN_EDGE_DATASET:");
        Console.WriteLine("  Normal end of execution.");
        Console.WriteLine("");
    }