예제 #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 test03( )

//****************************************************************************80
//
//  Purpose:
//
//    TEST03 tests LATIN_COVER_3D.
//
//  Licensing:
//
//    This code is distributed under the GNU LGPL license.
//
//  Modified:
//
//    05 August 2012
//
//  Author:
//
//    John Burkardt
//
    {
        Console.WriteLine();
        Console.WriteLine("TEST03");
        Console.WriteLine("  LATIN_COVER_3D");

        for (int n = 3; n <= 9; n += 2)
        {
            int seed = 123456789;
            for (int test = 1; test <= 3; test++)
            {
                int[] p1 = typeMethods.perm_uniform_new(n, ref seed);
                typeMethods.perm_print(n, p1, "  Permutation 1");

                int[] p2 = typeMethods.perm_uniform_new(n, ref seed);
                typeMethods.perm_print(n, p2, "  Permutation 2");

                int[] p3 = typeMethods.perm_uniform_new(n, ref seed);
                typeMethods.perm_print(n, p3, "  Permutation 1");

                int[] a = LatinVariants.latin_cover_3d(n, p1, p2, p3);

                typeMethods.i4block_print(n, n, n, a, "  Latin cover");
            }
        }
    }
예제 #3
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("");
    }