There are a few tests of whether a two qubit state is entangled. One is to perform the so-called 'partial transpose', which can be done with the partialtranspose
function in quantum-octave. If the resulting matrix has any negative eigenvalues, you know that your original state was entangled.
Another test works only when your two qubit state is pure (note: a state can be said to be either pure or mixed, depending on whether it has only a single non-zero eigenvalue, or multiple non-zero eigenvalues). To test this you can look at the eigenvalues. Or you can calculate the Von Neumann entropy with vnentropy
. This returns a value of zero only for pure states.
Once you have a pure state of two qubits and want to test for entanglement, your next step is to perform a partial trace using ptrace
. This will give a description of the state of just one of your qubits. If this state is also pure, your overall two qubit state is not entangled. But if it is mixed, it is entangled. To determine which is true, you can again use vnentropy
. The result of this can be regarded as a measure of how entangled the state is.
Another measure of entanglement, and one that works even when your overall state is the concurrence. This can be calculated in quantum-octave with concurrence
.
There's also a bunch of other ways. As you learn about entanglement you will learn many concepts, and then you'll find that many of those have an implementation in quantum-octave.