CHP/Tableau Commands

Creating and manipulating

Juqst.TableauMethod
Tableau(n::Integer)

sets up and returns the a CHP Tableau for n qubits.

This is based on the formalism given by: Improved Simulation of Stabilizer Circuits, Scott Aaronson and Daniel Gottesman, arXiv:quant-ph/0406196v5

The initial tableau represents a |00...0$\rangle$ ket in the stabiliser state This stabilises with "Z" and anti-stabilises with "X" So the tableau starts off with an Identity in the 'anti commute' top half in the X section and identity in the commuting (bottom) half in the Z section.

For the purposes of this port, the tableau is exactly replicated as per the paper i.e. the "state" (Tableau.state) is an Int32 array (used as a bit array) containing the following information.

 x11   .....  x1n | z11   ...      z1n | r1
  .    \       .  |  .    \          . |  .
  .     \      .  |  .     \         . |  .     Destabilisers
  .      \     .  |  .      \        . |  .
 xn1      \   xnn | zn1      \      znn| rn
 ______________________________________________
 x(n+1)1. x(n+1)n | z(n+1) ... z(n+1)n | r(n+1)
  .    \       .  |  .      \        . |  .
  .     \      .  |  .       \       . |  .     Stabilisers
  .      \     .  |  .        \      . |  .
 x(2n)1   \x(2n)n | z(2n)1     \ z(2n)n| r(2n)

Set Tableau.showRaw to true to see the underlying state as a matrix.

See also: cnot, hadamard, phase, measure, X, Z

Related: cliffordToTableau

Juqst.hadamardFunction
hadamard(t::Tableau,qubit::Integer,showOutput::Bool=false)

Performs a hadamard gate on the specified qubit of the tableau.

See also: cnot, phase, measure, X, Z

hadamard(t::Tableau,qubits::Integer...;showOutput::Bool = false)

Peforms hadamards on each of the qubits supplied.

Examples

julia> hadamard(t,2,3,1)

See also: cnot phase, measure, X, Z

Juqst.phaseFunction
phase(t::Tableau,qubit::Integer,showOutput::Bool=false)

Performs a phase gate on the specified qubit of the tableau.

See also: cnot, hadamard, measure, X, Z

phase(t::Tableau,qubits::Integer...;showOutput::Bool = false)

Peforms phase on each of the qubits supplied.

Examples

julia> phase(t,2,3,1)

See also: cnot hadamard, measure, X, Z

Juqst.cnotFunction
cnot(t::Tableau,control::Integer,target::Integer,showOutput=false)

Performs a CNOT (controlled not) on the tableau, with the specified qubits as control and target.

If showOutput is passed as true the state of the tableau subsequent to the cnot is printed.

See also: hadamard, phase, measure, X, Z

Juqst.XFunction
X(t::Tableau,qubit::Integer,showOutput::Bool=false)

Convenience function to perform an 'X' gate on the tableau. Performs hadamard, two phase gates and a hadamard.

See also: cnot, hadamard, measure, Z, phase

X(t::Tableau,qubits::Integer...;showOutput::Bool = false)

Convenience function to perform an 'X' gate on the tableau on each of the qubits supplied. Performs the gate by doing a hadamard, two phase gates and a hadamard on each of the qubits.

Examples

julia> X(t,2,3,1)

See also: cnot hadamard, measure, phase, Z

Juqst.ZFunction
Z(t::Tableau,qubit::Integer,showOutput::Bool=false)

Convenience function to perform a 'Z' gate on the tableau. Performs two phase gates.

See also: cnot, hadamard, measure, X, phase

Z(t::Tableau,qubits::Integer...;showOutput::Bool = false)

Convenience function to perform a 'Z' gate on the tableau on each of the qubits supplied. Performs the gate by doing two phase gates.

Examples

julia> Z(t,2,3,1)

See also: cnot hadamard, measure, X, Z

Juqst.measureFunction
measure(t::Tableau,qubit::Integer)

Performs a measurement on the supplied qubit. If the Tableau is not in a Z eigenstate, it will (pseudo) randomly choose the result and collapse the Tableau approriately.

measure(t::Tableau,qubits::Integer...;showOutput = false)

Performs a measurement on the supplied qubits. Results are reported in a dictionary of outcomes.

Examples

julia> using Main.CHP

julia> t = Tableau(4)

+XIII
+IXII
+IIXI
+IIIX
-----
+ZIII
+IZII
+IIZI
+IIIZ


julia> measure(t,1,2)
Dict{Any,Any}(2=>0,1=>0)
julia>
measure(s,measureNoise, allZs)

Helper function in open-systems.jl Pass in the state, the noise (as a superOperator) and the measurements - use allZs to generate) returns the mapped function (x->x'measureNoises,allZs)

Juqst.ketsFunction
kets(tableau::Tableau)

returns a string showing the kets of the state stabilised by the tableau.

Juqst.initialiseFunction
initialise(t::Tableau)

Initialises the Tableau, setting it support the |000000> state. However, unlike reinitialse it does not change the commands associated with the Tableau.

See also: reinitialise

Juqst.reinitialiseFunction
reinitialise(t::Tableau)

Reinitialise the Tableau, setting it support the |000000> state. Resets all commands associated with the Tableau.

See also: initialise

Tableaus and Cliffords

Juqst.cliffordToTableauFunction
cliffordToTableau(qubits,clifford,signs)

Converts an integer into a Clifford. You need to specify the number of qubits in the tableau, the clifford number and the bit signs corresponding to the rows of the Tableau. The commands used to create the Clifford can be found in Tableau.commands and Tableau.executeCommands.? It is fine to specify numbers that are too large (they wrap), but the helper functions

getNumberOfSymplecticCliffords(n::BigInt)::BigInt
getNumberOfBitStringsCliffords(n)

Will show how many cliffords there are for a certain number of qubits (Warning this is a very large number for n > 2)

Juqst.tableauToCliffordFunction
tableauToClifford(t::Tableau)

Returns the 'symplectic' number that corresponds to the clifford embedded in the Tableau. Note that this is modulo the bit signs. I.e. the tableaus corresponding to e.g. cliffordToTableau(1,3,3) and cliffordToTableau(1,3,4) will both return 3.

Juqst.decomposeStateFunction
decomposeState(tableau::Tableau,rationalise=true)

Decomposes the state stabilised by the Tableau using the Aaronsen/Gottesman method

That is it will decompose the "arbitrary" state into a series of CHP (cnot, hadamard and phase) gates. This is unlikely to be the most concise decomposition. Unless rationalise is set to false there will be some naive trimming of gates, basically self eliminating gates (e.g. 4 phase gates) are removed. The commands (and the execCommands) in the tableau are wiped and recreated. Following the decomposition the state is re-created using the new commands.

Juqst.getNumberOfSymplecticCliffordsFunction
getNumberOfSymplecticCliffords(n::Integer)::BigInt

returns the number of Cliffords for n qubits, modulo the signs on each row of the tableau. Note

getNumberOfCliffords(n) == getNumberOfSymplecticCliffords(n)*getNumerOfBitStringsCliffords(n)

Juqst.getNumberOfBitStringsCliffordsFunction
getNumberOfBitStringsCliffords(n)

returns the number of bitstrings representing a +/- on each row for the Tableau. Note:

getNumberOfCliffords(n) == getNumberOfSymplecticCliffords(n)*getNumerOfBitStringsCliffords(n)

Generating Clifford matrices

Juqst.generateRawCliffordsFunction
generateRawCliffords(;phaseGate=[1 0;0 im],hadmardGate=1/sqrt(2)*[1 1;1 -1])::Array{Complex{Float64},2}[]

returns the single qubit cliffords, generated using the passed in phase and hadamard gates (perfect gates default)

Juqst.makeFromCommandFunction
makeFromCommand(command)

Takes the commands in a Tableau and uses them to build a matrix representing the Tableau (in the computational basis)
Uses the original initialise command to determine the size of the system.
Note: for many qubits this gets quite big (scales as $2^n$)
makeFromCommand(t::Tableau)

Uses the commands stored in a Tableau and uses them to build a matrix representing the Tableau (in the computational basis)
Uses the original initialise command to determine the size of the system.
Note: for many qubits this gets quite big (scales as $2^n$)