  We study the structure of bipartite unitary operators which generate via the
Stinespring dilation theorem, quantum operations preserving some given matrix
algebra, independently of the ancilla state. We characterize completely the
unitary operators preserving diagonal, block-diagonal, and tensor product
algebras. Some unexpected connections with the theory of quantum Latin squares
are explored, and we introduce and study a Sinkhorn-like algorithm used to
randomly generate quantum Latin squares.
