baddb11a55a68c29cdc319bc9dde6e0a24ad32fe,cirq/ionq/serializer.py,Serializer,serialize,#Serializer#Any#,55

Before Change


            raise ValueError(
                f"All qubits must be cirq.LineQubits but were {set(type(q) for q in all_qubits)}"
            )
        num_qubits = cast(line_qubit.LineQubit, max(all_qubits)).x + 1
        return {"qubits": num_qubits, "circuit": self._serialize_circuit(circuit, num_qubits)}

    def _serialize_circuit(self, circuit: "cirq.Circuit", num_qubits: int) -> list:
        return [self._serialize_op(op) for moment in circuit for op in moment]

After Change


        self._validate_circuit(circuit)
        num_qubits = self._validate_qubits(circuit.all_qubits())

        serialized_ops = self._serialize_circuit(circuit)

        // IonQ API does not support measurements, so we pass the measurement keys through
        // the metadata field.  Here we split these out of the serialized ops.
        body = {
            "qubits": num_qubits,
            "circuit": [op for op in serialized_ops if op["gate"] != "meas"],
        }
        metadata = self._serialize_measurements(op for op in serialized_ops if op["gate"] == "meas")
        return SerializedProgram(body=body, metadata=metadata)

    def _validate_circuit(self, circuit: "cirq.Circuit"):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: quantumlib/Cirq
Commit Name: baddb11a55a68c29cdc319bc9dde6e0a24ad32fe
Time: 2020-12-08
Author: dabacon@gmail.com
File Name: cirq/ionq/serializer.py
Class Name: Serializer
Method Name: serialize


Project Name: mortendahl/tf-encrypted
Commit Name: e086b02bf4d19fbdcc751bfa876d03f2fcdaf375
Time: 2019-01-10
Author: mortendahlcs@gmail.com
File Name: tf_encrypted/tensor/int100.py
Class Name: Int100Factory
Method Name: tensor


Project Name: quantumlib/Cirq
Commit Name: 905083cfe74a71e8cbcf5238ce4156c65f4db56d
Time: 2020-12-10
Author: tony.bruguier@gmail.com
File Name: examples/direct_fidelity_estimation.py
Class Name:
Method Name: direct_fidelity_estimation