Beispiel #1
0
static float compute_median(float *firstbin, int step, int count)
{
    float *tmp;
    int i;
    tmp=aligned_alloca(count*sizeof(float));
    for(i=0; i<count; i++)tmp[i]=firstbin[i*step];
    sort_floats(tmp, count);
    if(!(count & 1))return (tmp[count>>1]+tmp[(count>>1)-1])/2.0;
    return tmp[count>>1];
}
Beispiel #2
0
void nonparametric(float *firstbin, int step, int count, float *median, float *ks_test)
{
    float *tmp;
    double a,b,lambda;
    int i;
    tmp=aligned_alloca(count*sizeof(float));
    for(i=0; i<count; i++)tmp[i]=firstbin[i*step];
    sort_floats(tmp, count);
    if(count & 1)*median=(tmp[count>>1]+tmp[(count>>1)+1])/2.0;
    else *median=tmp[count>>1];
Beispiel #3
0
int file_handle(char *path)
{
	FILE *f = fopen(path, "r");
	char buff[1024];

	if(f != NULL) {
		while(fgets(buff, sizeof(buff), f) != 0) {
			sort_floats(buff, sizeof(buff));
			printf("\n");
		}
		fclose(f);
		return 0;
	} else {
		printf("No access to file.\n");
		return 1;
	}
}