Skip to content

Commit

Permalink
💡 update reference (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
nquetschlich committed Jun 3, 2024
1 parent 1eabe2a commit cc3a2ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -131,17 +132,17 @@ Munich Quantum Valley, which is supported by the Bavarian state government with

<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/mqt-predictor/main/docs/_static/tum_dark.svg" width="28%">
<img src="https://raw.githubusercontent.com/cda-tum/mqt-predictor/main/docs/_static/tum_light.svg" width="28%">
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/mqt-predictor/quantum_generative_modeling/docs/_static/tum_dark.svg" width="28%">
<img src="https://raw.githubusercontent.com/cda-tum/mqt-predictor/quantum_generative_modeling/docs/_static/tum_light.svg" width="28%">
</picture>
<picture>
<img src="https://raw.githubusercontent.com/cda-tum/mqt-predictor/main/docs/_static/logo-bavaria.svg" width="16%">
<img src="https://raw.githubusercontent.com/cda-tum/mqt-predictor/quantum_generative_modeling/docs/_static/logo-bavaria.svg" width="16%">
</picture>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/mqt-predictor/main/docs/_static/erc_dark.svg" width="24%">
<img src="https://raw.githubusercontent.com/cda-tum/mqt-predictor/main/docs/_static/erc_light.svg" width="24%">
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/mqt-predictor/quantum_generative_modeling/docs/_static/erc_dark.svg" width="24%">
<img src="https://raw.githubusercontent.com/cda-tum/mqt-predictor/quantum_generative_modeling/docs/_static/erc_light.svg" width="24%">
</picture>
<picture>
<img src="https://raw.githubusercontent.com/cda-tum/mqt-predictor/main/docs/_static/logo-mqv.svg" width="28%">
<img src="https://raw.githubusercontent.com/cda-tum/mqt-predictor/quantum_generative_modeling/docs/_static/logo-mqv.svg" width="28%">
</picture>
</p>
12 changes: 7 additions & 5 deletions quantum_generative_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)(
Expand Down Expand Up @@ -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))
Expand All @@ -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}
Expand Down

0 comments on commit cc3a2ba

Please sign in to comment.