I don't think i could explain how pissed I am because i can't find where i missed here..
Images can explain everything:
Debug screenshot, with nxxx value (used to call it n, but that crappy variable doesn't deserve such a cool name). Breakpoint was on first line of this method.
http://img202.imageshack.us/img202/5057/value.png
The code where the method is called, getA
and getB
are working.. EVERYTHING was working like 10 mins ago..
First comment is the method signature, second comment is the original code, which SHOULD work. (replaced n
variable with 0
to see if it would change anything.. turned out it didn't)
/*
void HASAntData::init(float** A,
float** B,
int nxxx,
int R,
float q,
float Q,
float q1,
float q2,
int S,
int maxrounds,
int nThreads,
int seed)
*/
data->init( qap->getA(),
qap->getB(),
0,
1,
2,
3,
4,
5,
6,
7,
8,
9);
/*
data->init( qap->getA(),
qap->getB(),
0,
cudahas_R,
cudahas_q,
cudahas_Q,
cudahas_q1,
开发者_C百科 cudahas_q2,
cudahas_S,
cudahas_max_rounds,
cudahas_m,
Tools::randomInt(0, INT_MAX));
*/
edit:
Here's the table with all variable values, the crossed one doesn't matter for this problem. See how some variables are OK, and some aren't
http://img831.imageshack.us/img831/6224/valuestable.png
It looks like all the values have shifted (Q is 2 instead of 3, q1 is 3 instead of 4, R is 0 instead of 1). Where an int is interpreted as float, weird values are expected.
I guess nxxx
must be seeing the value meant for B
.
Is there some mismatch between the definition and declaration of init
?
Using an optimized build? If so, that can confuse the debugger.
Otherwise, use AppVerifier to look for typical memory corruptions.
精彩评论