diff --git a/README.md b/README.md index 0bf732755..6e01a85c1 100644 --- a/README.md +++ b/README.md @@ -106,9 +106,10 @@ Afterwards, the plots of the paper can be generated by running the jupyter noteb In case you are using this work, we would be thankful if you referred to it by citing the following publication: ```bibtex -@misc{quetschlich2024application_compilation, +@inproceedings{quetschlich2024application_compilation, title = {{Towards Application-Aware Quantum Circuit Compilation}}, author = {N. Quetschlich and F. J. Kiwit and M. A. Wolf and C. A. Riofrio and A. Luckow and L. Burgholzer and R. Wille}, + booktitle = {IEEE International Conference on Quantum Software (QSW)}, year = {2024}, eprint = {2404.12433}, eprinttype = {arXiv}, @@ -131,17 +132,17 @@ Munich Quantum Valley, which is supported by the Bavarian state government with

- - + + - + - - + + - +

diff --git a/quantum_generative_modeling.py b/quantum_generative_modeling.py index 96d82e74f..6d46e39db 100644 --- a/quantum_generative_modeling.py +++ b/quantum_generative_modeling.py @@ -114,13 +114,13 @@ def train(self, circuit: QuantumCircuit, backend: fake_backend.FakeBackendV2) -> # Return the lowest KL divergence (Figure of merit) return best_kl, evolution_data - def kl_divergence(self, pmf_model: np.ndarray): + def kl_divergence(self, pmf_model: np.ndarray) -> np.ndarray: # Loss function bwteen target and model distribution pmf_model[pmf_model == 0] = 1e-8 return np.sum(self.target * np.log(self.target / pmf_model), axis=1) - def get_execute_circuit(self, circuit_transpiled: QuantumCircuit, backend: fake_backend.FakeBackendV2): - def execute_circuit(solutions, num_shots=None): + def get_execute_circuit(self, circuit_transpiled: QuantumCircuit, backend: fake_backend.FakeBackendV2) -> callable: + def execute_circuit(solutions: np.ndarray, num_shots: int | None = None) -> np.ndarray | None: # Execute the circuit and returns the probability mass function sample_dicts = Parallel(n_jobs=-1, verbose=0)( @@ -149,7 +149,7 @@ def execute_circuit(solutions, num_shots=None): return execute_circuit @staticmethod - def get_target(n_qubits): + def get_target(n_qubits: int) -> np.ndarray: # Target distribution side_dimension = int(2 ** (n_qubits / 2)) grid = np.zeros((side_dimension, side_dimension)) @@ -163,7 +163,9 @@ def get_target(n_qubits): return grid.flatten() - def generate_result(self, qc: QuantumCircuit, num_shots: int, index: int, backend: fake_backend.FakeBackendV2): + def generate_result( + self, qc: QuantumCircuit, num_shots: int, index: int, backend: fake_backend.FakeBackendV2 + ) -> dict[int, dict[int, int]]: job = backend.run(qc, shots=num_shots) samples_dictionary = job.result().get_counts(qc).int_outcomes() return {index: samples_dictionary}