Closed KowerKoint closed 2 years ago
Thanks for the report.
I confirmed the operation using the following sample code.
from qulacsvis import circuit_drawer
from qulacs import QuantumCircuit
from qulacs.circuit import QuantumCircuitOptimizer
n = 5
depth = 10
circuit = QuantumCircuit(n)
for d in range(depth):
for i in range(n):
circuit.add_H_gate(i)
print(circuit)
# Optimization
opt = QuantumCircuitOptimizer()
# max_block_size = 3
max_block_size = 1
opt.optimize(circuit, max_block_size)
print(circuit)
circuit_drawer(circuit, "mpl")
In both cases, the depth is 1, but as was pointed out, when max_block_size = 1
, the number of target qubits is 1. I will fix the document.
Thank you.
Output:
*** Quantum Circuit Info ***
# of qubit: 5
# of step : 10
# of gate : 50
# of 1 qubit gate: 50
Clifford : yes
Gaussian : no
*** Quantum Circuit Info ***
# of qubit: 5
# of step : 1
# of gate : 5
# of 1 qubit gate: 5
Clifford : yes
Gaussian : no
Output:
*** Quantum Circuit Info ***
# of qubit: 5
# of step : 10
# of gate : 50
# of 1 qubit gate: 50
Clifford : yes
Gaussian : no
*** Quantum Circuit Info ***
# of qubit: 5
# of step : 1
# of gate : 2
# of 1 qubit gate: 0
# of 2 qubit gate: 1
# of 3 qubit gate: 1
Clifford : yes
Gaussian : no
In the section Calculation and optimization of depth of quantum circuits of the documentation, there is description
The code below uses the optimize function to repeat the greedy synthesis of the quantum gate of the quantum circuit until the target qubit becomes three.
However, the code below has a linemax_block_size = 1
. I thinkThe code below uses the optimize function to repeat the greedy synthesis of the quantum gate of the quantum circuit until the target qubit becomes one.
is correct.