Пример #1
0
    private static void r8vec_sht_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    R8VEC_SHT_TEST tests R8VEC_SHT.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    27 February 2010
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const double ahi = 5.0;
        const double alo = 0.0;
        const int    n   = 17;

        Console.WriteLine("");
        Console.WriteLine("R8VEC_SHT_TEST");
        Console.WriteLine("  R8VEC_SHT does a forward or backward slow Hartley transform.");
        Console.WriteLine("");
        Console.WriteLine("  The number of data items is N = " + n + "");
        //
        //  Set the data values.
        //
        int seed = 123456789;

        double[] c = UniformRNG.r8vec_uniform_ab_new(n, alo, ahi, ref seed);

        typeMethods.r8vec_print_part(n, c, 10, "  The original data:");
        //
        //  Compute the coefficients.
        //
        double[] d = Slow.r8vec_sht(n, c);

        typeMethods.r8vec_print_part(n, d, 10, "  The Hartley coefficients:");
        //
        //  Now compute inverse transform of coefficients.  Should get back the
        //  original data.
        //
        double[] e = Slow.r8vec_sht(n, d);

        typeMethods.r8vec_print_part(n, e, 10, "  The retrieved data:");
    }