G
Guest
Hi Folks!
For some reasons, this code:
is 10-100 times faster than this
Why is assigning a value that slow?
can anybody help me?
Thanks in advance for your efforts
-Chucker
For some reasons, this code:
float tmp = 0.;
for (int i = 0; i < 2000; i++) {
for (int j = i; j < 2000; j++) {
for (int k = 0; k < 9000; k++) {
tmp += tmp_mat(k,i) * tmp_mat(k,j);
}
tmp = 0.;
}
cout << "J: " << i << endl;
}
is 10-100 times faster than this
float tmp = 0.;
for (int i = 0; i < 2000; i++) {
for (int j = i; j < 2000; j++) {
for (int k = 0; k < 9000; k++) {
tmp += tmp_mat(k,i) * tmp_mat(k,j);
}
data2d[j] = tmp; // the problem
tmp = 0.;
}
cout << "J: " << i << endl;
}
Why is assigning a value that slow?
can anybody help me?
Thanks in advance for your efforts
-Chucker