Example #1
0
def main(input_files: List[str]) -> None:
    device = cirq.google.Sycamore
    transformers = {
        'dynamic look-ahead placement':
        ct.DynamicLookAheadHeuristicCircuitTransformer(device),
        'middle-out placement':
        ct.ConnectivityHeuristicCircuitTransformer(device),
    }
    for input_file in input_files:
        circuit = load_circuit_file(input_file)
        optimized = optimize(input_file, circuit)
        for name, transformer in transformers.items():
            suffix = f'{input_file} with {name}'
            try:
                transformed = benchmark_transform(suffix, optimized,
                                                  transformer)
                device.validate_circuit(transformed)
            except Exception as e:
                print(f'failed: {suffix}')
                print(e)
def test_split_then_merge_trapezoid(device):
    c = cirq.Circuit(qm.split_move(a1, a2, b1), qm.normal_move(a2, a3),
                     qm.merge_move(a3, b1, b3))
    t = ct.DynamicLookAheadHeuristicCircuitTransformer(device)
    device.validate_circuit(t.transform(c))