Skip to content

Commit

Permalink
make circuit compact
Browse files Browse the repository at this point in the history
  • Loading branch information
soranjh committed Nov 24, 2023
1 parent 4b305bb commit e5c175b
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions demonstrations/tutorial_block_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
The angles :math:`\alpha` are obtained from the matrix elements of the matrix :math:`A` as
:math:`\alpha_1 = \text{arccos}(A_{00}), ...,` and :math:`M` is the transformation matrix that can
be obtained with the :func:`~.pennylane.templates.state_preparations.mottonen.compute_theta`
function.
function of PennyLane.
Let's now construct the FABLE block encoding circuit for a structured matrix.
"""
Expand Down Expand Up @@ -150,17 +150,11 @@ def HN(input_wires):
@qml.qnode(dev)
def circuit():
HN(wires_i)

qml.Barrier() # to separate the sections in the circuit

qml.Barrier() # to separate the sections in the circuit
UA(thetas, control_wires, ancilla_wires)

qml.Barrier()

UB(wires_i, wires_j)

qml.Barrier()

HN(wires_i)
return qml.probs(wires=ancilla_wires + wires_i)

Expand Down Expand Up @@ -340,17 +334,11 @@ def UB(wires_i, wires_j):
@qml.qnode(dev)
def complete_circuit(thetas):
HN(wires_i)

qml.Barrier()

qml.Barrier() # to separate the sections in the circuit
UA(thetas, wires_i, ancilla_wires)

qml.Barrier()

UB(wires_i, wires_j)

qml.Barrier()

HN(wires_i)
return qml.probs(wires=ancilla_wires + wires_i)

Expand Down

0 comments on commit e5c175b

Please sign in to comment.