Skip to content

Commit

Permalink
Merge pull request #23 from KMU-quantum-classroom/develop
Browse files Browse the repository at this point in the history
Feature : change to return gate names per circuit layer
  • Loading branch information
minwook-shin authored Sep 13, 2023
2 parents 687e7c7 + e022984 commit 7d862d2
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 73 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# CHANGELOG.md

## 0.3.0 (2023-09-13)

Features :

- Changed to return gate names per circuit layer when converting to matrix.
- case : If a lot of qubit and layer 0 has x gate and cx gate.
- ```[(0, ['x', 'cx'])]```

Dependencies:

- Bump ipython from 8.14.0 to 8.15.0
- Bump notebook from 7.0.2 to 7.0.3
- Bump loguru from 0.7.0 to 0.7.2
- Bump build from 0.10.0 to 1.0.3
- Bump tox from 4.10.0 to 4.11.3
- Bump coverage from 7.3.0 to 7.3.1
- Bump pdoc from 14.0.0 to 14.1.0

## 0.2.0 (2023-08-26)

Features :
Expand Down
121 changes: 68 additions & 53 deletions docs/qiskit_class_converter.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/search.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = ['qiskit_class_converter*tests']

[project]
name = "qiskit-classroom-converter"
version = "0.2.0"
version = "0.3.0"
authors = [
{ name = "KMU-quantum-classroom" },
]
Expand All @@ -28,21 +28,21 @@ classifiers = [
dependencies = [
"qiskit==0.44.1",
"qiskit-aer==0.12.2",
"loguru==0.7.0",
"loguru==0.7.2",
"sympy==1.12",
"antlr4-python3-runtime==4.11",
"ipython==8.14.0",
"ipython==8.15.0",
"numpy==1.25.2"
]

[project.optional-dependencies]
dev = [
"coverage==7.3.0",
"coverage==7.3.1",
"pylint==2.17.5",
"tox==4.10.0",
"build==0.10.0",
"pdoc==14.0.0",
"notebook==7.0.2"
"tox==4.11.3",
"build==1.0.3",
"pdoc==14.1.0",
"notebook==7.0.3"
]

[project.urls]
Expand Down
7 changes: 7 additions & 0 deletions qiskit_class_converter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
docker-compose up --build
```
or use a Docker Image.
```shell
$ docker pull ghcr.io/kmu-quantum-classroom/qiskit-classroom-converter
$ docker run -p 8888:8888 ghcr.io/kmu-quantum-classroom/qiskit-classroom-converter
```
# Acknowledgement
- 국문 : "본 연구는 2022년 과학기술정보통신부 및 정보통신기획평가원의 SW중심대학사업의 연구결과로 수행되었음"(2022-0-00964)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@ class QuantumCircuitToMatrixConverter(BaseConverter):

def actual_convert_action(self):
self.logger.debug("quantum circuit to matrix")
gate_list = [self.input_value.data[i][0].name
for i in range(len(self.input_value.data))]
matrix_list = {"gate": [], "name": gate_list}
matrix_list = {"gate": [], "name": []}
# type validate
if isinstance(self.input_value, (List, QuantumCircuit)):
dag = self.qiskit.converters.circuit_to_dag(self.input_value)
else:
raise TypeError("QuantumCircuit is required.")
layer_index = 0
for layer in dag.layers():
circuit = self.qiskit.converters.dag_to_circuit(layer['graph'])
matrix_list["gate"].append(self.qiskit.quantum_info.Operator(circuit).to_matrix())
matrix_list["name"].append((layer_index, [_inst[0].name for _inst in circuit.data]))
layer_index += 1
matrix_list["result"] = self.qiskit.quantum_info.Operator(self.input_value).to_matrix()
if self.option.get("print", False) == "raw":
latex_source_list = {"gate": [], "name": gate_list}
latex_source_list = {"gate": [], "name": matrix_list["name"]}
for each_matrix in matrix_list["gate"]:
latex_source_list["gate"].append(
array_to_latex(array=np.array(each_matrix), source=True))
Expand Down
10 changes: 5 additions & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
coverage==7.3.0
coverage==7.3.1
pylint==2.17.5
tox==4.10.0
build==0.10.0
pdoc==14.0.0
notebook==7.0.2
tox==4.11.3
build==1.0.3
pdoc==14.1.0
notebook==7.0.3
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
qiskit==0.44.1
qiskit-aer==0.12.2
loguru==0.7.0
loguru==0.7.2
sympy==1.12
antlr4-python3-runtime==4.11
ipython==8.14.0
ipython==8.15.0
numpy==1.25.2

0 comments on commit 7d862d2

Please sign in to comment.