Predefined Quantum Circuits
The submodule QuantumSavory.CircuitZoo provides reusable common quantum circuits.
Autogenerated API list for QuantumSavory.CircuitZoo
QuantumSavory.CircuitZoo.Purify2to1 — Typestruct Purify2to1 <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
leaveout: A symbol specifying which of the three Pauli errors to leave undetectable.
A simple purification circuit sacrificing a Bell pair to produce another. The circuit is parameterized by a single leaveout symbol argument which specifies which of the three possible Pauli errors are to be left undetected. A simple purificaiton circuit is not capable of detecting all errors.
If an error was detected, the circuit returns false and the state is reset. If no error was detected, the circuit returns true.
The sacrificial qubits are removed from the register.
julia> a = Register(2)
b = Register(2)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
initialize!((a[1], b[1]), bell)
initialize!((a[2], b[2]), bell);
julia> Purify2to1(:X)(a[1], b[1], a[2], b[2])
true
julia> observable((a[1], b[1]), projector(bell))
1.0 + 0.0imHowever, an error might have occurred on the initial state. If the error is detectable, the Purify2to1 circuit will return false and the state will be reset.
julia> a = Register(2)
b = Register(2)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
initialize!((a[1], b[1]), bell)
initialize!((a[2], b[2]), bell)
apply!(a[1], Z);
julia> Purify2to1(:X)(a[1], b[1], a[2], b[2])
false
julia> a
Register with 2 slots: [ Qubit | Qubit ]
Slots:
nothing
nothingIn some cases the error might not be detectable. In that case, the Purify2to1 circuit does return true, but as you can see below, the state is not what we would expect from a successful purification.
julia> a = Register(2)
b = Register(2)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
initialize!((a[1], b[1]), bell)
initialize!((a[2], b[2]), bell)
apply!(a[1], X);
julia> Purify2to1(:X)(a[1], b[1], a[2], b[2])
true
julia> observable((a[1], b[1]), projector(bell))
0.0 + 0.0imSee also: Purify2to1Node, Purify3to1, PurifyExpedient, PurifyStringent
QuantumSavory.CircuitZoo.Purify2to1Node — Typestruct Purify2to1Node <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
leaveout: A symbol specifying which of the three Pauli errors to leave undetectable.
A purification circuit sacrificing 2 Bell qubits to produce another qubit. The circuit is parameterized by a single leaveout symbol argument which specifies which of the three possible Pauli errors are to be left undetected. A simple purificaiton circuit is not capable of detecting all errors.
This is only "half" of the full purification circuit - the local gates to be applied at a network node. For a complete purification circuit, you need to apply this circuit to the remote node as well. Alternatively, you can use the complete Purifiy2to1](@ref) circuit.
This circuit returns the measurements result (as an integer index among the possible basis states).
julia> a = Register(2)
b = Register(2)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
initialize!((a[1], b[1]), bell)
initialize!((a[2], b[2]), bell);
julia> Purify2to1Node(:X)(a[1:2]...) == Purify2to1Node(:X)(b[1:2]...)
trueQuantumSavory.CircuitZoo.Purify3to1 — Typestruct Purify3to1 <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
leaveout1: The error to be fixed twiceleaveout2
A purification circuit sacrificing a Bell pair to produce another. The circuit is parameterized by a leaveout1, and a leaveout2 symbol argument which specifies the leaveout of each of the two purification subcircuits This purificaiton circuit is capable of detecting all errors.
If an error was detected, the circuit returns false and the state is reset. If no error was detected, the circuit returns true.
The sacrificial qubits are removed from the register.
julia> a = Register(2)
b = Register(2)
c = Register(2)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
initialize!(a[1:2], bell)
initialize!(b[1:2], bell)
initialize!(c[1:2], bell);
julia> Purify3to1(:Z, :Y)(a[1], a[2], b[1], c[1], b[2], c[2])
trueQuantumSavory.CircuitZoo.Purify3to1Node — Typestruct Purify3to1Node <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
leaveout1: The error to be fixed twiceleaveout2
A purification circuit sacrificing 2 Bell qubits to produce another. The circuit is parameterized by a leaveout1, and a leaveout2 symbol argument which specifies the leaveout of each of the two purification subcircuits This purificaiton circuit is capable of detecting all errors.
This circuit returns the array of measurements made.
This circuit is the same as the Purifiy3to1 one but it works on individual qubits (i.e. only one qubit of a pair)
This algorithm is detailed in (Fujii and Yamamoto, 2009)
julia> a = Register(2)
b = Register(2)
c = Register(2)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
initialize!(a[1:2], bell)
initialize!(b[1:2], bell)
initialize!(c[1:2], bell);
julia> Purify3to1Node(:Z, :Y)(a[1], b[1], c[1]) == Purify3to1Node(:Z, :Y)(a[2], b[2], c[2])
trueQuantumSavory.CircuitZoo.PurifyExpedient — Typestruct PurifyExpedient <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
The EXPEDIENT purification circuit. It is composed of a head and a body. The head is repeated twice and the body is also repeating twice
The difference between it and the STRINGENT circuit is that the body is shorter.
If an error was detected, the circuit returns false and the state is reset. If no error was detected, the circuit returns true.
This circuit is detailed in (Naomi H. Nickerson and Benjamin, 2013)
The sacrificial qubits are removed from the register.
julia> r = Register(22)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
for i in 1:11
initialize!(r[(2*i-1):(2*i)], bell)
end;
julia> PurifyExpedient()(r[1], r[2], r[3:2:21]..., r[4:2:22]...)
trueSee also: PurifyExpedientNode, PurifyStringent
QuantumSavory.CircuitZoo.PurifyExpedientNode — Typestruct PurifyExpedientNode <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
The EXPEDIENT purification circuit (only the local half, executed on a single network node).
This returns the array of measurements made by the circuit.
This circuit is detailed in (Naomi H. Nickerson and Benjamin, 2013).
julia> r = Register(22)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
for i in 1:11
initialize!(r[(2*i-1):(2*i)], bell)
end;
julia> PurifyExpedientNode()(r[1], r[3:2:21]...) == PurifyExpedientNode()(r[2], r[4:2:22]...)
trueQuantumSavory.CircuitZoo.PurifyStringent — Typestruct PurifyStringent <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
The STRINGENT purification circuit. It is composed of a "head" and a "body". The head is repeated twice and the body is also repeating twice
This algorithm is detailed in (Stefan Krastanov and Jiang, 2019)
If an error was detected, the circuit returns false and the state is reset. If no error was detected, the circuit returns true.
This circuit is detailed in (Naomi H. Nickerson and Benjamin, 2013).
The sacrificial qubits are removed from the register.
julia> r = Register(26)
bell = (Z₁⊗Z₁+Z₂⊗Z₂)/√2
for i in 1:13
initialize!(r[(2*i-1):(2*i)], bell)
end;
julia> PurifyStringent()(r[1], r[2], r[3:2:25]..., r[4:2:26]...)
trueSee also: PurifyStringentNode, PurifyExpedient
QuantumSavory.CircuitZoo.PurifyStringentNode — Typestruct PurifyStringentNode <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
The STRINGENT purification circuit (only the local half, executed on a single network node).
This returns the array of measurements made by the circuit.
This circuit is detailed in (Naomi H. Nickerson and Benjamin, 2013).
See also: PurifyStringent
QuantumSavory.CircuitZoo.SDDecode — Typestruct SDDecode <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
The circuit for Superdense Coding to decode the 2 (classical) bit message using the entangled bell pair stored in the registers regA and regB after Alice's encoding of the first qubit. Returns a Tuple of the decoded message.
julia> regA = Register(1); regB = Register(1);
julia> initialize!((regA[1], regB[1]), (L0⊗L0+L1⊗L1)/√2);
julia> message = (1, 1);
julia> SDEncode()(regA[1], message);
julia> SDDecode()(regA[1], regB[1])
(1, 1)See also SDEncode
QuantumSavory.CircuitZoo.SDEncode — Typestruct SDEncode <: QuantumSavory.CircuitZoo.AbstractCircuitFields:
The circuit for Superdense Coding to encode the 2 (classical) bit message to its corresponding Bell pair representation. It takes as argumes a single qubit register containing Alice's half of the entangled Bell pair and the 2 bit message Alice intends to send to Bob.
julia> regA = Register(1); regB = Register(1);
julia> initialize!((regA[1], regB[1]), (L0⊗L0+L1⊗L1)/√2);
julia> message = (1, 1);
julia> SDEncode()(regA[1], message);See also SDDecode