Skip to content

Commit

Permalink
docstring fix
Browse files Browse the repository at this point in the history
  • Loading branch information
austingmhuang committed Jul 25, 2024
1 parent aab0301 commit b329777
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pennylane/registers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,11 @@ def registers(register_dict):
**Example**
Given input ``{"ancilla": {"sub_ancilla": 2, "sub_ancilla1": 1}}``, ``qml.registers()`` creates
a dictionary with 3 key-value pairs. The keys are the register names found in the input:
"ancilla", "sub_ancilla" and "sub_ancilla1". The values are the respective :class:`~.Wires`
objects for each register. For example, "ancilla" has two sub registers "sub_ancilla" and
"sub_ancilla1". Therefore, the value associated with key "ancilla" is the union of the
:class:`~.Wires` of its sub registers. Since its sub registers "sub_ancilla" and "sub_ancilla1"
have :class:`~.Wires` objects ``Wires([0, 1])`` and ``Wires([2])`` respectively, the key "ancilla"
has the value ``Wires([0, 1, 2])``.
Given flat input dictionary:
>>> qml.registers({"alice": 2, "bob": 3})
{'alice': Wires([0, 1]), 'bob': Wires([2, 3, 4])}
Given nested input dictionary:
>>> wire_registers = qml.registers({"ancilla": {"sub_ancilla": 2, "sub_ancilla1": 1}})
>>> wire_dict
{'sub_ancilla': Wires([0, 1]), 'sub_ancilla1': Wires([2]), 'ancilla': Wires([0, 1, 2])}
Expand Down

0 comments on commit b329777

Please sign in to comment.