IsEntanglingGate

IsEntanglingGate is a function that determines if a bipartite or multipartite unitary is an entangling gate or not (i.e., whether or not there is a product vector that is no longer a product vector after the unitary is applied). If it is an entangling gate, a product vector that is entangled by the gate can be provided, and if it is not an entangling gate then a decomposition that proves that it is not entangling can be provided.

Syntax

 * EG = IsEntanglingGate(U)
 * EG = IsEntanglingGate(U,DIM)
 * [EG,WIT] = IsEntanglingGate(U,DIM)

Input arguments

 * U: An operator (typically a unitary operator) that acts on a bipartite or multipartite Hilbert space.
 * DIM (optional, by default has two subsystems of equal dimension): A specification of the dimensions of the subsystems that U lives on. DIM can be provided in one of three ways:
 * If DIM</tt> is a scalar, it is assumed that U</tt> lives on the tensor product of two spaces, the first of which has dimension DIM</tt> and the second of which has dimension length(U)/DIM</tt>.
 * If $U \in M_{n_1} \otimes \cdots \otimes M_{n_p}$ then DIM</tt> should be a row vector containing the dimensions (i.e., DIM = [n_1, ..., n_p]</tt>).
 * If the subsystems aren't square (i.e., $U \in M_{m_1, n_1} \otimes \cdots \otimes M_{m_p, n_p}$) then DIM</tt> should be a matrix with two rows. The first row of DIM</tt> should contain the row dimensions of the subsystems (i.e., the mi's) and its second row should contain the column dimensions (i.e., the ni's). In other words, you should set DIM = [m_1, ..., m_p; n_1, ..., n_p]</tt>.

Output arguments

 * EG</tt>: Either 1 or 0, indicating that U</tt> is or is not an entangling gate.
 * WIT</tt> (optional): If EG = 0</tt> (i.e., U</tt> is not an entangling gate), then WIT</tt> is a struct with fields WIT.perm</tt> and <tt>WIT.dec</tt> such that <tt>PermutationOperator(DIM,WIT.perm)*Tensor(WIT.dec)</tt> equals <tt>U</tt> and thus verifies that <tt>U</tt> is indeed not an entangling gate. If <tt>EG = 1</tt> (i.e., <tt>U</tt> is an entangling gate) then <tt>WIT</tt> is a (sparse) product pure state that is entangled by <tt>U</tt>. Furthermore, <tt>WIT</tt> will always have 2 or fewer non-zero entries in this case.

A bipartite example: the CNOT gate
The following code verifies that the CNOT gate is an entangling gate. The following code also requests a product pure state <tt>wit</tt> that is entangled by the CNOT gate. The product pure state returned in this case is $(|0\rangle + |1\rangle) \otimes |0\rangle/\sqrt{2}$, which maps to the Bell state $(|00\rangle + |11\rangle)/\sqrt{2}$: