Note that the big endian convention is in use, such that qubits are labeled left-to-right, starting with 1. For example, the decimal representation of (which means 1⊗2⊗3) is 20x+21y+22z.
Additionally, for the eigenvalues of Pauli-Z, there is:
Denote the eigenstate {1,0} by (which corresponds to +1 eigenvalue), and {0,1} by (which corresponds to the eigenvalue -1).
In the following, we will briefly review some major quantum functionalities in our framework.
Quantum Basis and Quantum State (12)
A computational basis can be defined by inputting the dimension information as arguments of QuantumBasis. Alternatively, an association can be used, with the basis name are given as the keys and the corresponding basis elements are specified as the values.
Define a 3D quantum basis (computational):
Given a basis of dimension n, the basis elements will be indexed by the key with :
With no input, the dimension is set as 2:
Use QuantumBasis[n,m] to define a basis for m qudits of dimension n (for which the overall dimension will be ). For example, define a 2×2×2-dimensional quantum basis:
Use QuantumBasis[{n1,n2,…,nm}] to define an n1×n2×n3×…×nm-dimensional Hilbert space of qudits as a list. For example, define a 3×5-dimensional quantum basis (with two qudits):
A basis can also be defined as an association with the basis element names as keys and the corresponding vectors as values:
There are many 'named' bases built into the quantum framework, including "Computational", "PauliX", "PauliY", "PauliZ" ((or simply "X", "Y" or "Z"), "Fourier", "Identity", "Schwinger", "Pauli", "Dirac" and "Wigner":
After a basis object has been defined, it is straightforward to construct quantum states and operators. A quantum state is represented by a QuantumState object and a quantum operator is represented by QuantumOperator.
A state can be defined by two arguments: QuantumState[arg1,arg2], where arg1 specifies amplitudes or the density matrix, and arg2 specifies the basis. With no basis specified, the default basis will be the computational basis, the dimension of which depends on the amplitude vector given in arg1.
Define a pure 2D quantum state (qubit) in the Pauli-X basis:
If the basis is not specified, the default is the computational basis of dimensions ( qubits):
Binary strings can also be used as inputs:
Many "named" states are available through the framework:
A state can also be defined by inputting a density matrix:
Define a generic Bloch vector:
Test to see if it is a mixed state:
Calculate its von Neumann entropy:
Compute its purity:
Note that one can directly use a Bloch vector as an input:
Quantum Operators (6)
Quantum operators can be defined by a matrix or by specifying eigenvalues with respect to a QuantumBasis. Additionally, there are many built-in named operators that can be used.
Define a Pauli-X operator:
Apply a Pauli-X operator to a symbolic state :
Test to see if the application of the Pauli-X operator yields the correct state:
Multi-qubit operators can take specific orders.
For instance, first define the state α+β:
Then, apply a Pauli-X operator on the second qubit only (by defining an order for the operator):
Test the result:
For multi-qudit cases, one can define an order or construct the operator using QuantumTensorProduct. For example:
One can define a "Controlled" operator with specific target and control qudits:
Return the control and target qudits:
Get the action of the operator (T-controlled (1, 2)) on :
Note that "CT" is also a "named" controlled operator in this framework:
One can create a new operator by performing some mathematical operations (e.g., exponential, fraction power, etc.) on a quantum operator:
Show that the result is the same as a rotation operator around x:
Get the fractional power of the NOT operator:
Quantum Measurement (10)
In the Wolfram Quantum Framework, one can study projective measurements or, generally, any positive operator-valued measurement (POVM) using QuantumMeasurementOperator.
PVMs (projective measurements) (3)
A measurement can be defined by specifying the corresponding measurement basis.
Measure a 3D system in its state basis:
For composite systems, one can measure one or more qudits. This can be done by specifying an order for QuantumMeasurementOperator.
2D×3D composite system:
Measure only the first qudit:
Measure only the second qudit:
Measure both qudits:
POVMs (7)
One can also give a list of POVM elements by which to define the measurement operator:
Check that all POVM elements are explicitly positive semidefinite:
Check the completeness relations:
Measure POVMs on a quantum state:
Get the post-measurement states:
Get the corresponding probabilities:
Show that post-measurement states are the same as states initially defined as POVMs:
Quantum Partial Tracing, Partial Transposing, Distance and Entanglement (4)
In the framework, there are some functionalities to explore the quantum distance, entanglement monotones and partial tracing, as well as other useful features.
Trace out the second subsystem in a 2-qubit state:
A partial trace can also be applied to QuantumBasis:
Given a Werner state (two qubits, with probability p), take the partial transpose with respect to qubit-2:
To know whether a state is entangled (or part of that state), use QuantumEntangledQ.
Test if W-state of 4-qubits is entangled or not:
Test if qubit-1 and 3 are entangled or not:
In quantum information, there exist notions of distance between quantum states, such as fidelity, trace distance, Bures angle, etc. One can use QuantumDistance to compute the distance between two quantum states with various metrics.
Measure the trace distance between a pure state and a mixed state:
Quantum Circuits (4)
One may create a list of QuantumOperator and/or QuantumMeasurementOperator objects to build a quantum circuit, which can be represented as a QuantumCircuitOperator object.
Construct a quantum circuit that includes a controlled Hadamard gate:
The wire labels can be customized (for more info, please refer to Diagram documentation):
Define a combination of control-0 and control-1 qubits:
Measurement operators can also be added to a quantum circuit. For a single-qubit unitary operator with eigenvalues ±1, a measurement of can be implemented in the following circuit (note that here, Pauli-Y is considered a operator):
Applying the circuit operators to a quantum state results in a quantum measurement:
Calculate the state of the second qubit after the measurement by tracing over the first qubit:
The post-measurement states of the second qubit should be the same as the Pauli-Y eigenstates.
There are many named circuits in the Wolfram quantum framework:
quantum phase estimation, for QuantumOperator[{"Phase",2π/5}], in four steps (ie using 4-qubits):
Bernstein-Vazirani circuit, given a secret string:
Graph circuit, given a graph:
Grover search algorithm, given a Boolean function:
Ising-type of interactions and their Trotter-Suzuki decomposition (4th order):