This is the code I am working with in C. It seems like a simple swap for variables.
#define ELEM_SWAP(a,b) { register double t=(a);(a)=(b);(b)=t; }
But I have seen it called like so
ELEM_SWAP(array[x], array[y]).
I am trying to emulate this macro in Python 3 using numpy arrays. The closest equivalent I have to this is this function but it seems like the C code swaps variables and the Python swaps the items inside the list.
def elem_swap(mylist, x, y):
mylist[x], mylist[y] = mylist[y], mylist[x]
return mylist