I am currently doing matrix transpose with C. In my algorithm there are a lot of swap operations. I need to exchange the two double precision number that two (double*) points points to.
void transposenRightHalf(double *m, int size){
double temp;
for (int i = 0; i < size-1; i++) {
for (int j = i+1; j < size; j++) {
temp = *(m+i*size+j);
*(m+i*size+j) = *(m+j*size+i);
*(m+j*size+i) = temp;
}
}
}
Since I am doing this on a cray machine, which uses x86 architecture, I am trying to use inline assemble to do the swap operation. I did some searching but could not find one. I really need some help.