# IsEntanglingGate

IsEntanglingGate | |

Determines if a unitary is an entangling gate | |

Other toolboxes required | none |
---|---|

Related functions | IsProductOperator OperatorSchmidtDecomposition OperatorSchmidtRank |

Function category | Entanglement and separability |

` 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)`

## Argument descriptions

### 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`is a scalar, it is assumed that`U`lives on the tensor product of two spaces, the first of which has dimension`DIM`and the second of which has dimension`length(U)/DIM`. - If $U \in M_{n_1} \otimes \cdots \otimes M_{n_p}$ then
`DIM`should be a row vector containing the dimensions (i.e.,`DIM = [n_1, ..., n_p]`). - 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`should be a matrix with two rows. The first row of`DIM`should contain the row dimensions of the subsystems (i.e., the m_{i}'s) and its second row should contain the column dimensions (i.e., the n_{i}'s). In other words, you should set`DIM = [m_1, ..., m_p; n_1, ..., n_p]`.

- If

### Output arguments

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

## Examples

### 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 `wit` 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}$:

```
>> U = [1 0 0 0;0 1 0 0;0 0 0 1;0 0 1 0];
>> [eg,wit] = IsEntanglingGate(U)
eg =
1
wit =
(1,1) 0.7071
(3,1) 0.7071
>> U*wit
ans =
0.7071
0
0
0.7071
```

## Notes

Despite the name and description of the function, it can be used on non-unitary (and even non-square) operators just fine. If `U` is not unitary, the function has the exact same interpretation: it determines whether or not there is a product vector that is mapped to a non-product vector.

## Source code

Click here to view this function's source code on github.