added module mod_swap for swapping matrices