def getDiagonalSwitchedTetragridByPolar(diagonals, unitPolar):
 diagonalSwitchedTetragrid = getIdentityTetragrid()
 for diagonal in diagonals:
  diagonalSwitchedTetragrid[diagonal][diagonal] = unitPolar.real
 diagonalSwitchedTetragrid[diagonals[0]][diagonals[1]] = (- unitPolar.imag)
 diagonalSwitchedTetragrid[diagonals[1]][diagonals[0]] = unitPolar.imag
 return diagonalSwitchedTetragrid

def getDiagonalSwitchedTetragridByPolar ( diagonals , unitPolar ) : diagonalSwitchedTetragrid = getIdentityTetragrid ( ) for diagonal in diagonals : diagonalSwitchedTetragrid [ diagonal ] [ diagonal ] = unitPolar . real diagonalSwitchedTetragrid [ diagonals [ 0 ] ] [ diagonals [ 1 ] ] = ( - unitPolar . imag ) diagonalSwitchedTetragrid [ diagonals [ 1 ] ] [ diagonals [ 0 ] ] = unitPolar . imag return diagonalSwitchedTetragrid
get the diagonals and switched matrix by unitpolar .