Gate - Maple Help

QuantumComputing

 Gate
 return a quantum gate

 Calling Sequence Parameters Description

 Calling Sequence Gate(gatestr, options) Gate()
 Parameters

 gatestr - string; symbol of the quantum gate options - name or algebraic; if the gate depends on angles, then any of the three angles, lambda, phi, and theta, can be set as optional keyword parameters; they can be set to any algebraic expression including integers, rational and irrational numbers, constants like Pi, symbols, and polynomials.

Description

 • The Gate command converts a string symbol of the quantum gate into a Matrix representation of the gate.
 • The Gate command without arguments yields a list of the known gates.

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)

Now Maple knows the standard 1- and 2-qubit gates.  For example, Pauli Z gate

 >
 ${\mathrm{Uz}}{≔}\left[\begin{array}{cc}{1}& {0}\\ {0}& {-1}\end{array}\right]$ (2)

or the Pauli X and Y gates

 >

 ${\mathrm{Uz}}{,}{\mathrm{Uy}}{≔}\left[\begin{array}{cc}{0}& {1}\\ {1}& {0}\end{array}\right]{,}\left[\begin{array}{cc}{0}& {-I}\\ {I}& {0}\end{array}\right]$ (3)

or the most general 1-qubit gate, known as the U (universal) gate that depends on 3 angles that we keep symbolic

 >

 ${\mathrm{Uu}}{≔}\left[\begin{array}{cc}{\mathrm{cos}}{}\left(\frac{{\mathrm{\theta }}}{{2}}\right)& {-}{{ⅇ}}^{{I}{}{\mathrm{\lambda }}}{}{\mathrm{sin}}{}\left(\frac{{\mathrm{\theta }}}{{2}}\right)\\ {{ⅇ}}^{{I}{}{\mathrm{\phi }}}{}{\mathrm{sin}}{}\left(\frac{{\mathrm{\theta }}}{{2}}\right)& {{ⅇ}}^{{I}{}\left({\mathrm{\phi }}{+}{\mathrm{\lambda }}\right)}{}{\mathrm{cos}}{}\left(\frac{{\mathrm{\theta }}}{{2}}\right)\end{array}\right]$ (4)

or a 2-qubit gate like the CNOT gate

 >
 ${\mathrm{Ucnot}}{≔}\left[\begin{array}{cccc}{1}& {0}& {0}& {0}\\ {0}& {0}& {0}& {1}\\ {0}& {0}& {1}& {0}\\ {0}& {1}& {0}& {0}\end{array}\right]$ (5)

All known gates can be returned by calling the command without arguments

 > $\mathrm{Gate}\left(\right);$
 $\left\{{"CH"}{,}{"CNOT"}{,}{"CP"}{,}{"CPhase"}{,}{"CS"}{,}{"CT"}{,}{"CU"}{,}{"CX"}{,}{"CY"}{,}{"CZ"}{,}{"H"}{,}{"I"}{,}{"P"}{,}{"Rx"}{,}{"Ry"}{,}{"Rz"}{,}{"S"}{,}{"SWAP"}{,}{"T"}{,}{"U"}{,}{"X"}{,}{"Y"}{,}{"Z"}{,}{"fSWAP"}{,}{"iSWAP"}\right\}$ (6)
 >