CHP/Tableau Commands
Creating and manipulating
Juqst.Tableau
— MethodTableau(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.hadamard
— FunctionJuqst.phase
— FunctionJuqst.cnot
— FunctionJuqst.X
— FunctionX(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)
Juqst.Z
— FunctionJuqst.measure
— Functionmeasure(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.kets
— Functionkets(tableau::Tableau)
returns a string showing the kets of the state stabilised by the tableau.
Juqst.initialise
— Functioninitialise(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.reinitialise
— Functionreinitialise(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.cliffordToTableau
— FunctioncliffordToTableau(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.tableauToClifford
— FunctiontableauToClifford(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.decomposeState
— FunctiondecomposeState(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.getNumberOfCliffords
— FunctiongetNumberOfCliffords(n::Integer)::BigInt
returns the number of Cliffords for n qubits.
Juqst.getNumberOfSymplecticCliffords
— FunctiongetNumberOfSymplecticCliffords(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.getNumberOfBitStringsCliffords
— FunctiongetNumberOfBitStringsCliffords(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.generateRawCliffords
— FunctiongenerateRawCliffords(;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.makeFromCommand
— FunctionmakeFromCommand(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$)