Beispiel #1
0
    private static void r8vec_sqct_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    R8VEC_SQCT_TEST tests R8VEC_SQCTB and R8VEC_SQCTF.
    //
    //  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   = 256;

        Console.WriteLine("");
        Console.WriteLine("R8VEC_SQCT_TEST");
        Console.WriteLine("  R8VEC_SQCTF does a forward slow quarter wave cosine transform;");
        Console.WriteLine("  R8VEC_SQCTB does a backward slow quarter wave cosine transform.");
        Console.WriteLine("");
        Console.WriteLine("  The number of data items is N = " + n + "");
        //
        //  Set the data values.
        //
        int seed = 123456789;

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

        typeMethods.r8vec_print_part(n, x, 10, "  The original data:");
        //
        //  Compute the coefficients.
        //
        double[] y = Slow.r8vec_sqctf(n, x);

        typeMethods.r8vec_print_part(n, y, 10, "  The cosine coefficients:");
        //
        //  Now compute inverse transform of coefficients.  Should get back the
        //  original data.
        //
        double[] z = Slow.r8vec_sqctb(n, y);

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