Wolfram

# QuantumFramework

Perform analytic and numeric computation in Quantum Information Theory

Contributed By: Wolfram Research, Quantum Computation Framework team

Quantum Computing is an emerging technology that could revolutionize how computations are performed in the future. It operates based on the law of quantum mechanics - a radically different law of physics from the one our current computers are based on. A quantum computer may be able to solve problems that are difficult to solve using current computers such as breaking encryption, simulating a quantum system, or enhancing machine learning algorithms.

The Wolfram Language Quantum Computation Framework performs high-level analytic and numeric computations in Quantum Information Theory, allowing simulation of quantum circuits and quantum algorithms. Starting from discrete quantum mechanics, this framework can work with quantum states and quantum operators, implements measurements, performs basis manipulation, computes measure entanglement, and more. The semantics is very intuitive and it is equipped with various named states and operators such as Bell states, Pauli operators, universal quantum gates, and others. Thus, making it easy for people to simulate a quantum computer using the Wolfram Language.

## Details

## Examples

### Quantum Basis and State (19)

In our Quantum Framework, a quantum state is defined with respect to a QuantumBasis. For pure states, the given input can be a list of amplitudes, or an association with keys corresponds to basis elements and values as amplitudes.

Define a 2D quantum basis (computational):

In[1]:= |

Out[1]= |

Given the basis dimension n, the basis elements will be indexed by ket with i=0,1,...,n-1

In[2]:= |

Out[2]= |

Use a sequence as QuantumBasis[n,m], for n qudits of m-dimensional (overall dimension will be n^{m}). For example, let us define a 2×2×2 dimensional quantum basis (three qubits):

In[3]:= |

Out[3]= |

In[4]:= |

Out[4]= |

Use a list as QuantumBasis[{n_{1},n_{2},...,n_{m}}] for n_{1}×n_{2}×n_{2}×...×n_{m} dimensional Hilbert space of m qudits. For example, define a 3×5 dimensional quantum basis (two qudits):

In[5]:= |

Out[5]= |

In[6]:= |

Out[6]= |

A basis can also be defined by an association with the basis element names as keys, and corresponding vectors as values.

In[7]:= |

Out[7]= |

There are many named-basis built in the quantum framework, {"Computational", "PauliX", "PauliY", "PauliZ","Fourier", "Identity","Schwinger", "Pauli", "Dirac", "Wigner"}:

In[8]:= |

Out[8]= |

After a basis object has been defined, it is straightforward to use it to construct quantum states and operators. A quantum state is represented by QuantumState object and a quantum operator is represented by QuantumOperator.

For pure quantum states, a vector with elements as amplitudes, and the corresponding basis should be given in this format: QuantumState[*amp_List*,QuantumBasis[*args*]]. With no basis specified, the default basis will be the computational basis whose dimension depends on the amplitude vector.

Define a pure 2-dimensional quantum state (qubit) in the Pauli-X basis:

In[9]:= |

Out[9]= |

In[10]:= |

Out[10]= |

If the basis is not specified, the default is the computational basis of 2^{n} dimension (n qubits):

In[11]:= |

Out[11]= |

Out[12]= |

If the vector has more than 2 elements, it is interpreted as a n-qubit state (by right-padding of zeros), unless the dimension is specified.

In[13]:= |

Out[13]= |

In[14]:= |

Out[14]= |

Same amplitude vector, but this time the dimension is specified:

In[15]:= |

Out[16]= |

Many named states are available for easy access:

In[17]:= |

Out[17]= |

Using associations, one can create a superposition of states, with keys as a list of corresponding indexes, and values as amplitudes. For example, let us create a superposition of 3 qubits (i.e., QuantumBasis[2,3]) as :

In[18]:= |

Out[18]= |

In[19]:= |

Out[19]= |

In[20]:= |

Out[20]= |

A different way of creating superposition is simple adding two quantum state objects. For example, the previous state can be constructed as follows, too:

In[21]:= |

Out[19]= |

Once a built-in basis is specified, amplitudes correspond to the basis elements. For example, let's use Bell basis:

In[22]:= |

Out[22]= |

In[23]:= |

Out[23]= |

In[24]:= |

Out[24]= |

We can also define a state by inputting a density matrix:

In[25]:= |

Out[25]= |

For pure states, one can get the corresponding normalized state vector:

In[26]:= |

Out[26]= |

Define a generic Bloch vector:

In[27]:= |

In[28]:= |

Out[20]= |

Test if it is a mixed state:

In[29]:= |

Out[29]= |

Calculate Von Neumann Entropy:

In[30]:= |

Out[30]= |

Purity:

In[31]:= |

Out[31]= |

A pure state (by normalizing the vector r):

In[32]:= |

Out[32]= |

Purity:

In[33]:= |

Out[33]= |

Calculate Bloch Spherical Coordinates

In[34]:= |

Out[34]= |

A matrix that is not positive semi-definite (cannot be a density matrix in standard QM, but in ZX-formalism we can have situations like this):

In[35]:= |

Out[35]= |

A non positive-semidefinite matrix as state:

In[36]:= |

Out[36]= |