Created
May 6, 2016 13:44
-
-
Save Sleepingwell/65736198fe13eaf38f977c3aba018879 to your computer and use it in GitHub Desktop.
Very basic empirical distribution (for unordered data).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "emperical_dist.h" | |
void emperical_dist(double* vals, double* res, int* vlen, int* dlen) { | |
int i, j, tmp, n = *vlen; | |
double *valsAt, val; | |
for(i=0; i<*dlen; ++i, ++res){ | |
valsAt = vals; | |
val = *res; | |
tmp = 0; | |
for(j=0; j<n; ++j, ++valsAt) if(*valsAt <= val) ++tmp; | |
*res = (double)tmp / (double)n; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment