Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the Hilbert space distance between two discrete quantum states
ResourceFunction["QuantumDistance"][QuantumDiscreteState[qds1,…],QuantumDiscreteState[qds2,…]] returns the fidelity distance (defined below) between the discrete quantum states qds1 and qds2. | |
ResourceFunction["QuantumDistance"][QuantumDiscreteState[qds1,…],QuantumDiscreteState[qds2,…],measure] returns the distance using the Hilbert space distance measure measure. |
| "Fidelity" | 1 minus the fidelity of the two states (i.e. 1 minus the most general probability that the two states will measure to be equivalent) |
| "RelativeEntropy" | relative von Neumann entropy distance between the two states (i.e. the quantum analog of the Kullback–Leibler divergence) |
| "Trace" | trace distance between the density matrices of the two states (i.e. the quantum analog of the Kolmogorov–Smirnov distance) |
| "BuresAngle" | infinitesimal Bures angle distance between the density matrices of the two states (i.e. the quantum analog of the Fisher information metric) |
| "HilbertSchmidt" | Hilbert–Schmidt information distance between the two states |
| "Bloch" | coordinate distance between two qubit states on the Bloch sphere |
Find the default (fidelity) distance between two trivial pure quantum states:
| In[1]:= |
| Out[1]= |
| In[2]:= |
| Out[2]= |
| In[3]:= |
| Out[3]= |
Find the fidelity distance between two mixed quantum states:
| In[4]:= | ![]() |
| Out[4]= | ![]() |
Find the default (fidelity) distance between a pure state and a mixed state:
| In[5]:= | ![]() |
| Out[5]= |
Find the trace distance between the same pure state and mixed state:
| In[6]:= |
| Out[6]= |
Find the coordinate distance between two random pure qubit states on the Bloch sphere:
| In[7]:= | ![]() |
| Out[7]= |
Find the relative von Neumann entropy distance between two random 5-dimensional pure states:
| In[8]:= | ![]() |
| Out[8]= |
Find distances between multiqubit states:
| In[9]:= | ![]() |
| Out[9]= |
Find distances between higher-dimensional qudit states:
| In[10]:= | ![]() |
| Out[10]= | ![]() |
Fidelity distances can be computed between any combination of arbitrary pure and mixed states:
| In[11]:= | ![]() |
| In[12]:= |
| Out[12]= |
| In[13]:= |
| Out[13]= |
| In[14]:= |
| Out[14]= |
| In[15]:= |
| Out[15]= | ![]() |
Relative entropy distances can be computed between any combination of arbitrary pure and mixed states:
| In[16]:= | ![]() |
| In[17]:= |
| Out[17]= |
| In[18]:= |
| Out[18]= |
| In[19]:= |
| Out[19]= |
| In[20]:= |
| Out[20]= |
Trace distances can be computed between any combination of arbitrary pure and mixed states:
| In[21]:= | ![]() |
| In[22]:= |
| Out[22]= |
| In[23]:= |
| Out[23]= |
| In[24]:= |
| Out[24]= |
| In[25]:= |
| Out[25]= |
Infinitesimal Bures angle distances can be computed between any combination of arbitrary pure and mixed states:
| In[26]:= | ![]() |
| In[27]:= |
| Out[27]= |
| In[28]:= |
| Out[28]= |
| In[29]:= |
| Out[29]= |
| In[30]:= |
| Out[30]= | ![]() |
Hilbert–Schmidt distances can be computed between any combination of arbitrary pure and mixed states:
| In[31]:= | ![]() |
| In[32]:= |
| Out[32]= |
| In[33]:= |
| Out[33]= |
| In[34]:= |
| Out[34]= |
| In[35]:= |
| Out[35]= |
Coordinate distances on the Bloch sphere can be computed between any combination of arbitrary pure and mixed qubit (2-dimensional) states:
| In[36]:= | ![]() |
| In[37]:= |
| Out[37]= |
| In[38]:= |
| Out[38]= |
| In[39]:= |
| Out[39]= |
| In[40]:= |
| Out[40]= |
However, Bloch distances cannot be computed for arbitrary qudit (higher-dimensional) states (returns unevaluated):
| In[41]:= | ![]() |
| Out[41]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License