static int test_vec_lmsf(void)
{
    int i;
    int j;
    float x[100];
    float ya[100];
    float yb[100];
    float ratio;

    printf("Testing vec_lmsf()\n");
    for (i = 0;  i < 99;  i++)
    {
        x[i] = rand();
        ya[i] =
        yb[i] = rand();
    }
    for (i = 1;  i < 99;  i++)
    {
        vec_lmsf(x, ya, i, 0.1f);
        vec_lmsf_dumb(x, yb, i, 0.1f);
        for (j = 0;  j < i;  j++)
        {
            ratio = ya[j]/yb[j];
            if (ratio < 0.9999f  ||  ratio > 1.0001f)
            {
                printf("vec_lmsf() - %d %e %e\n", j, ya[j], yb[j]);
                printf("Tests failed\n");
                exit(2);
            }
        }
    }
    return 0;
}
Example #2
0
SPAN_DECLARE(void) vec_circular_lmsf(const float x[], float y[], int n, int pos, float error)
{
    vec_lmsf(&x[pos], &y[0], n - pos, error);
    vec_lmsf(&x[0], &y[n - pos], pos, error);
}