Say you have a specific base you want your number to represented in, my case is 5. I want to produce all numbers increment in the specific base rather than base 10. What I am really trying to do is produce all possible vectors of a certain dimension with a finite set of coefficients. Reason is to take the fft of each one basically all vectors in this function space. I have been looking through libraries and what not but haven’t found a way so I was wondering if anyone had advice on how to speed this up:
int bucket[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
while (bucket[0] != 5 && bucket[1] != 5 && bucket[2] != 5 && bucket[3] != 5 && bucket[4] != 5 && bucket[5] != 5 && bucket[6] != 5 && bucket[7] != 5 && bucket[8] != 5
&& bucket[9] != 5 && bucket[10] != 5 && bucket[11] != 5 && bucket[12] != 5 && bucket[13] != 5 && bucket[14] != 5 ){
bucket[0]++;
if (bucket[0] == 5) {
bucket[0] = 0;
bucket[1]++;
if (bucket[1] == 5) {
bucket[1] = 0;
bucket[2]++;
if (bucket[2] == 5) {
bucket[2] = 0;
bucket[3]++;
if (bucket[3] == 5) {
bucket[3] = 0;
bucket[4]++;
if (bucket[4] == 5) {
bucket[4] = 0;
bucket[5]++;
if (bucket[5] == 5) {
bucket[5] = 0;
bucket[6]++;
if (bucket[6] == 5) {
bucket[6] = 0;
bucket[7]++;
if (bucket[7] == 5) {
bucket[7] = 0;
bucket[8]++;
if (bucket[8] == 5) {
bucket[8] = 0;
bucket[9]++;
if (bucket[9] == 5) {
bucket[9] = 0;
bucket[10]++;
if (bucket[10] == 5) {
bucket[10] = 0;
bucket[11]++;
if (bucket[11] == 5) {
bucket[11] = 0;
bucket[12]++;
if (bucket[12] == 5) {
bucket[12] = 0;
bucket[13]++;
if (bucket[13] == 5) {
bucket[13] = 0;
bucket[14]++;
if (bucket[14] == 5) {
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
printf("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i\n", bucket[14],bucket[13],bucket[12],bucket[11],bucket[10],bucket[9],bucket[8],bucket[7],bucket[6],bucket[5],bucket[4],bucket[3],bucket[2],bucket[1],bucket[0]);
}
there is obvious symmetry to it, it would be nice to do this on the device end rather than host so I dont have to copy over any… advice is appreciated!