This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Gatesets
Marc Davis edited this page Apr 10, 2020
·
3 revisions
To synthesize with different gates or topologies, you will need to create an instance of an search_compiler.gatesets.Gateset
subclass.
# example: synthesizing for the ring topology
import search_compiler as sc
ring_gateset = sc.gatesets.QubitCNOTRing()
# use your gateset with a project
myproject = sc.Project("myproject")
myproject["gateset"] = ring_gateset
# or use it with SearchCompiler directly
mycompiler = sc.SearchCompiler(gateset=ring_gateset)
-
QubitCNOTLinear
- a gateset that is useful for synthesizing circuits with CNOTs and single qubit gates with the linear topology. It is similar toQiskitU3Linear
, but is slightly more efficient without sacrificing generality. It is the default gateset. -
QiskitU3Linear
- a gateset based on IBM's U3 gate and CNOTs for the linear topology. It is generally better to useQubitCNOTLinear
, which is more efficient. -
ZXZXZCNOTLinear
- a gateset based on the RZ-RX90-RZ-RX90-RZ decomposition of single qubit gates for the linear topology. It is generally better to useQiskitU3Linear
, which is more efficient.
-
QubitCNOTRing
- a gateset that is equivalent toQubitCNOTLinear
except it implements the ring topology. For 3 qubits, this is the triangle topology and is all-to-all. -
QubitCNOTAdjacencyList
- a gateset that takes a list of CNOT connections, and creates a gateset that is similar toQubitCNOTLinear
but uses a toplogy based on the adjacency list. If the desired topology can be achieved by usingQubitCNOTLinear
orQubitCNOTRing
, it is recommended to choose one of those because it will be more efficient.
# This would create a gateset for 4 qubits with CNOT connections 0 to 1, 0 to 2, and 1 to 3
mygateset = sc.gatesets.QubitCNOTAdjacencyList([(0,1), (0,2), (1,3)])
-
QubitCRZLinear
- a gateset that explores the usage of two sqrt(CNOT) gates and a Z gate to form a CRZ gate instead of a normal CNOT gate. -
QubitCRZRing
- a gateset that is similar toQubitCRZLinear
but implements the ring topology. For 3 qubits, the ring toplogy is the triangle topology and is fully connected.
-
QutritCPIPhaseLinear
- a gateset designed for qutrits that uses single qutrit gates and the CPI two-qutrit gate with a phase applied.
If none of these gatesets suite your needs, you can write your own! Make a subclass of sc.gatesets.Gateset
and implement these two functions:
-
intial_layer(dits)
The single input,dits
, is an integer which describes how many qudits will be in the circuit. The function returns a singlesc.circuits.QuantumStep
object representing an initial layer for the search. Normally, this is a kronecker product of single-qudit gates, and you can use the providedfill_row
helper function to produce this. -
search_layers(dits)
The single input,dits
, is an integer which describes how many qudits will be in the circuit. The function returns a list ofsc.circuits.QuantumStep
objects, each representing a possible building block in a possible location for expanding the current circuit.
See the existing implementations in sc.gatesets
for examples of how to write a gateset.