Skip to content

Commit

Permalink
docstring and __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
1ucian0 committed Mar 3, 2023
1 parent b33e1fa commit fbbcdb7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions qiskit/transpiler/passes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
ContainsInstruction
GatesInBasis
ConvertConditionsToIfOps
UnrollForLoops
"""

# layout selection (placement)
Expand Down Expand Up @@ -288,3 +289,4 @@
from .utils import ContainsInstruction
from .utils import GatesInBasis
from .utils import ConvertConditionsToIfOps
from .utils import UnrollForLoops
1 change: 1 addition & 0 deletions qiskit/transpiler/passes/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .contains_instruction import ContainsInstruction
from .gates_basis import GatesInBasis
from .convert_conditions_to_if_ops import ConvertConditionsToIfOps
from .unroll_forloops import UnrollForLoops

# Utility functions
from . import control_flow
8 changes: 3 additions & 5 deletions qiskit/transpiler/passes/utils/unroll_forloops.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@


class UnrollForLoops(TransformationPass):
"""UnrollForLoops transpilation pass unrolls for-loops when possible. Things like
`for x in {0, 3, 4} {rx(x) qr[1];}` will turn into `rx(0) qr[1]; rx(3) qr[1]; rx(4) qr[1];`.
"""
"""UnrollForLoops transpilation pass unrolls for-loops when possible."""

def __init__(self, max_target_depth=-1):
"""UnrollForLoops transpilation pass unrolls for-loops when possible. Things like
`for x in {0, 3, 4} {rx(x) qr[1];}` will turn into `rx(0) qr[1]; rx(3) qr[1]; rx(4) qr[1];`.
"""Things like `for x in {0, 3, 4} {rx(x) qr[1];}` will turn into
`rx(0) qr[1]; rx(3) qr[1]; rx(4) qr[1];`.
Args:
max_target_depth (int): Optional. Checks if the unrolled block is over a particular depth.
Expand Down

0 comments on commit fbbcdb7

Please sign in to comment.