예제 #1
0
static void test_inc_x(size_t i, const double *dx, const size_t *jdx, size_t ndx)
{
	size_t j, k;

	if (jdx) {
		for (k = 0; k < ndx; k++) {
			X[i * P + jdx[k]] += dx[k];
		}
	} else if (ndx) {
		assert(ndx == P);

		for (j = 0; j < P; j++) {
			X[i * P + j] += dx[j];
		}
	}
	recompute();

	mlogit_set_x(&MLOGIT, i, 0, P, X + i * P);
	//print_error("\tx...");
	test_x();
	//print_error("ok\n\tmean...");
	test_mean();
	//print_error("ok\n\tcov...");
	test_cov();
	//print_error("ok\n");
}
int main(int argc, char *argv[]) {
 
    /* inlined functions, test commented out */
    //printf("\n*** Testing bootstrap sample ***\n");
    //test_boostrap_sample();
    //printf("\n*** Testing compare doubles and qsort\n");
    //test_sort();
    //printf("\n*** Testing swap ***\n");
    //test_swap();
     
    /* regular functions */
    printf("\n*** Testing percentile ***\n");
    test_percentile();
    printf("\n*** Testing min idx ***\n");
    test_min_idx();
    printf("\n*** Testing mean ***\n");
    test_mean();
    printf("\n*** Testing std dev ***\n");
    test_std();
    printf("\n*** Testing binomial ***\n");
    test_binomial();
    printf("\n*** Testing fetcount ***\n");
    test_fetcount();
    printf("\n*** Testing shift table ***\n");
    test_shift_table();
    printf("\n*** Testing fet p0 ***\n");
    test_fet_p();
    printf("\n*** Testing fet ***\n");
    test_fet();

    test_all(argc, argv);
    test_thread(argc, argv);
    
    return 0;
    
}