PrepareState - Maple Help

QuantumComputing

 PrepareState
 prepare a quantum state

 Calling Sequence Parameters Description

 Calling Sequence PrepareState(circuit, inputstate, options)
 Parameters

 circuit - list of equations; The left side of an equation indicates the qubit or qubits on which the gate acts and the right side provides the gate itself. inputstate - polynom or Array; input quantum state in Dirac notation (polynom) or as a multidimensional Array (Array) options - The optional keyword dirac can be set to true (default) or false to determine whether the output state is returned in Dirac notation or Array notation.

Description

 • The PrepareState command accepts a circuit as a list of equations and an input quantum state.
 • In the circuit the left side of an equation indicates the qubit or qubits on which the gate acts and the right side provides the gate itself.  When the left side of an equation is a single qubit, it should be expressed as an integer, but when the left side represents two or more qubits, it should be expressed as a list of integers.  The right side of an equation can be generated by the Gate command.
 • The input quantum state can be expressed in Dirac notation (polynom) or as a multidimensional Array (Array).
 • The PrepareState command returns the quantum state obtained from applying the circuit to the initial quantum state.
 • The optional boolean keyword dirac determines whether the output state is returned in Dirac notation (true) or Array notation (false).
 • In Dirac notation the number of qubits is represented by the number of indices on the wave function symbol; in Array notation the number of qubits is represented by the number of dimensions of the Array.
 • The two states of each qubit are denoted as 0 and 1 in Dirac notation; they are represented by the range 1..2 of each dimension in Array notation.

Examples

First we load the QuantumChemistry package

 > $\mathrm{with}\left(\mathrm{QuantumChemistry}\right):$

Next we load the QuantumComputing subpackage

 > $\mathrm{with}\left(\mathrm{QuantumComputing}\right);$
 $\left[{\mathrm{ConvertDirac}}{,}{\mathrm{Gate}}{,}{\mathrm{InitialState}}{,}{\mathrm{MeasureState}}{,}{\mathrm{PrepareState}}{,}{\mathrm{QubitPopulations}}{,}{\mathrm{QubitPopulationsPlot}}\right]$ (1)

We can initialize a state of 4 qubits on our simulated quantum computer with the InitialState command

 >
 ${\mathrm{state0}}{≔}{{\mathrm{\Psi }}}_{{0}{,}{0}{,}{0}{,}{0}}$ (2)

The initial wave function has each of its 4 qubits in the lower state of the qubit, denoted by 0.  To illustrate preparing a state on the quantum computer, let's use a product of gates (unitary transformations), known as a circuit, to prepare a Schrodinger cat state in which the state of all qubits down becomes entangled with the state of all qubits up.  In QCT the circuit is readily assemble as a Maple list of equations.  The left side of an equation indicates the qubit or qubits on which the gate acts and the right side provides the gate itself.

 >

 ${\mathrm{circuit}}{≔}\left[{1}{=}\left[\begin{array}{cc}\frac{\sqrt{{2}}}{{2}}& \frac{\sqrt{{2}}}{{2}}\\ \frac{\sqrt{{2}}}{{2}}& {-}\frac{\sqrt{{2}}}{{2}}\end{array}\right]{,}\left[{1}{,}{2}\right]{=}\left[\begin{array}{cccc}{1}& {0}& {0}& {0}\\ {0}& {0}& {0}& {1}\\ {0}& {0}& {1}& {0}\\ {0}& {1}& {0}& {0}\end{array}\right]{,}\left[{2}{,}{3}\right]{=}\left[\begin{array}{cccc}{1}& {0}& {0}& {0}\\ {0}& {0}& {0}& {1}\\ {0}& {0}& {1}& {0}\\ {0}& {1}& {0}& {0}\end{array}\right]{,}\left[{3}{,}{4}\right]{=}\left[\begin{array}{cccc}{1}& {0}& {0}& {0}\\ {0}& {0}& {0}& {1}\\ {0}& {0}& {1}& {0}\\ {0}& {1}& {0}& {0}\end{array}\right]\right]$ (3)

To prepare the new state, we act on the initial state state0 with our circuit

 >

 ${\mathrm{state2}}{≔}\frac{\sqrt{{2}}{}{{\mathrm{\Psi }}}_{{0}{,}{0}{,}{0}{,}{0}}}{{2}}{+}\frac{\sqrt{{2}}{}{{\mathrm{\Psi }}}_{{1}{,}{1}{,}{1}{,}{1}}}{{2}}$ (4)

The new state entangles a state of 4 "down" qubits with a state of 4 "up" qubits.  Like Schrodinger's cat, our state is half up and half down.