Changeset 1027


Ignore:
Timestamp:
Oct 17, 2011, 1:45:40 PM (9 years ago)
Author:
sam
Message:

test: minor Remez algorithm tests.

Location:
trunk/test/math
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/math/remez-solver.h

    r1014 r1027  
    155155                b = zeroes[i];
    156156
    157             printf("Error for [%g..%g]: ", (double)a, (double)b);
    158157            for (;;)
    159158            {
     
    184183                        final = e;
    185184                    control[i] = (a + b) >> 1;
    186                     printf("%g (at %g)\n", (double)e, (double)control[i]);
    187185                    break;
    188186                }
     
    291289        }
    292290
    293         printf("Final polynomial:\n");
     291        printf("Polynomial estimate:\n");
    294292        for (int j = 0; j < ORDER + 1; j++)
    295293        {
  • trunk/test/math/remez.cpp

    r1014 r1027  
    2525
    2626/* The function we want to approximate */
    27 static real myfun(real const &x)
     27real myfun(real const &y)
    2828{
    29     real y = sqrt(x);
    30     return (sin(y) - y) / (x * y);
     29    real x = sqrt(y);
     30    return (sin(x) - x) / (x * y);
    3131}
    3232
    33 static real myerr(real const &x)
     33real myerr(real const &y)
    3434{
    35     real y = sqrt(x);
    36     return re(x * y);
     35    real x = sqrt(y);
     36    return sin(x) / (x * y);
    3737}
    3838
    3939int main(void)
    4040{
    41     RemezSolver<4> solver;
    42     solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 15);
     41    RemezSolver<6> solver;
     42    solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 40);
    4343
    4444    return EXIT_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.