specialized square matrix transpose for int and double