cirq.GridDeviceMetadata

Hardware metadata for homogenous 2d symmetric grid devices.

Inherits From: DeviceMetadata

Used in the notebooks

Used in the tutorials

qubit_pairs Iterable of pairs of cirq.GridQubits representing bi-directional couplings.
gateset cirq.Gateset indicating gates supported everywhere on the device.
gate_durations Optional dictionary of cirq.GateFamily instances mapping to cirq.Duration instances for gate timing metadata information. If provided, all keys must exist in gateset.
all_qubits Optional iterable specifying all qubits found on the device. If None, all_qubits will be inferred from the entries in qubit_pairs.
compilation_target_gatesets A collection of valid cirq.CompilationTargetGatesets which can be used to transform circuits into ones that consist of only operations in gateset.

ValueError if some GateFamily keys in gate_durations are not in gateset.
ValueError If qubit_pairs contains a self loop.
ValueError if all_qubits is provided and is not a superset of all the qubits found in qubit_pairs.

compilation_target_gatesets Returns a sequence of valid cirq.CompilationTargetGatesets for this device.
gate_durations Get a dictionary mapping from gate family to duration for gates.

To look up the duration of a specific gate instance / gate type / operation which is part of the device's gateset, you can search for its corresponding GateFamily. For example:

gateset = cirq.Gateset(cirq.ZPowGate)
durations = {cirq.GateFamily(cirq.ZPowGate): cirq.Duration(nanos=1)}
grid_device_metadata = cirq.GridDeviceMetadata((), gateset, durations)

my_gate = cirq.Z
gate_durations = grid_device_metadata.gate_durations
gate_duration = None
for gate_family in gate_durations:
    if my_gate in gate_family:
        gate_duration = gate_durations[gate_family]

print(gate_duration)
1 ns

gateset Returns the cirq.Gateset of supported gates on this device.
isolated_qubits Returns the set of all isolated qubits on the device (if applicable).
nx_graph Returns a nx.Graph where nodes are qubits and edges are couple-able qubits.
qubit_pairs Returns the set of all couple-able qubits on the device.

Each element in the outer frozenset is a 2-element frozenset representing a bidirectional pair.

qubit_set Returns the set of grid qubits on the device.

Methods

__eq__

View source

__ne__

View source