Ejemplo n.º 1
0
int galileo::c_jitter_sample2::generate(c_vector2* a)
{
	for (int i = 0; i < m; i++)
		for (int j = 0; j < n; j++)
			a[i*n + j] = c_vector2((i + (*rnd)()) / m, (j + (*rnd)()) / n);

	// shuffle
	for (int i = m*n - 2; i >= 0; i--) 
	{
		int target = int(t_float((*rnd)()) * t_float(i));
		c_vector2 temp = a[i + 1];
		a[i + 1] = a[target];
		a[target] = temp;
	}
	return m*n;
}
Ejemplo n.º 2
0
static void test_utility_TypeInfoWrapper()
{
    TypeInfoWrapper t_int(typeid(int));
    TypeInfoWrapper t_int1(typeid(3));
    TypeInfoWrapper t_float(typeid(3.0f));

    ASSERT(t_int == t_int1);
    ASSERT(t_int != t_float);
}
Ejemplo n.º 3
0
Archivo: hts_endian.c Proyecto: atks/vt
int main(int argc, char **argv) {
    int verbose = 0;
    int errors = 0;

    if (argc > 1 && strcmp(argv[1], "-v") == 0) verbose = 1;

    errors += t16_bit(verbose);
    errors += t32_bit(verbose);
    errors += t64_bit(verbose);
    errors += t_float(verbose);
    errors += t_double(verbose);
    if (errors) {
        fprintf(stderr, "%d errors\n", errors);
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
Ejemplo n.º 4
0
// main analysis function
void Helmholtz::analyzeframe()
{
    int n, tindex = timeindex;
    int mask = framesize - 1;
    int peak;
    t_float norm = 1. / sqrt(t_float(framesize * 2));
    
    // copy input to processing buffer
    for(n=0; n<framesize; n++) processbuf[n] = inputbuf[tindex++ & mask] * norm;
    
    // copy for normalization function
    for(n=0; n<framesize; n++) inputbuf2[n] = inputbuf[tindex++ & mask];
    
    // zeropadding
    for(n=framesize; n<(framesize<<1); n++) processbuf[n] = 0.;
    
    // call analysis procedures
    autocorrelation();
    normalize();
    pickpeak();
    periodandfidelity();
}