> I am wondering why we use swap function here? Why not sway value directly, like

> X.T[i], X.T[i + 1] = X.T[i + 1], X.T[i]

The swap function is much faster. It uses an low level blas routine.