Created
March 31, 2012 16:17
-
-
Save isag/2266492 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
double **select_subpool(Params *p, double **pool,int nrows,int nrows_sub) | |
{ | |
int positions[nrows]; | |
for(int i = 0 ; i < nrows ; ++i) positions[i] = i; | |
// shuffle the vector | |
//------------------- | |
knuth_shuffle((void*)positions, nrows, p->rng, sizeof(int*)); | |
for (int i = 0 ; i < nrows ; ++i) printf("%d\t",positions[i]); | |
printf("\n"); | |
} |
The code from facilication.c (line 64) is also broken. It works simply because, in many cases, sizeof(double*) returns 8, just like sizeof(double), but it might not be true for all computers (the size of pointers vary).
Ok, I applied the method for a matrix shuffle (that's why I put the *).
I will removed the star in facilitation too.
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's sizeof(int).
BTW if you name the file with a .c extension gist will add syntax highlighting.