Skip to content

Commit

Permalink
cirq_google.GridDevice, minus gateset and gate durations (quantumlib#…
Browse files Browse the repository at this point in the history
…5203)

Part of quantumlib#5050

* Implemented qubit set, qubit pairs, and op validation. Gateset and gate duration will be done in a follow-up.
* Added a `device_specification_validation` module shell, to be used by the QCS server side to validate the DeviceSpecification proto against things like: 
  * Qubit self-loops in qubit pairs
  * Qubit pairs contain qubits not in the valid qubit set.
  * Gate durations contains a gate which is missing in the gateset.

`__str__()` and `_repr_pretty_` are nearly all copied from `SerializableDevice`.

Part of quantumlib#5050

Also fixes quantumlib#5197

**Question:** Does this definition of device equality make sense, or should it contain device name as well? Implementing equality is convenient for json and repr tests but not sure if it make sense in general.

@dstrain115 @MichaelBroughton
  • Loading branch information
verult authored May 9, 2022
1 parent 75aa90e commit d630a83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cirq/devices/grid_device_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _from_json_dict_(
return cls(
qubit_pairs,
gateset,
None if gate_durations is None else dict(gate_durations),
dict(gate_durations) if gate_durations is not None else None,
all_qubits,
compilation_target_gatesets,
)

0 comments on commit d630a83

Please sign in to comment.