Skip to content

Commit

Permalink
Improve the docs for QubitCircuit.add_gate (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxiLi committed Dec 9, 2022
1 parent da5290d commit f7bcc35
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
24 changes: 13 additions & 11 deletions src/qutip_qip/circuit/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,24 @@ def add_gate(
gate: string or :class:`~.operations.Gate`
Gate name. If gate is an instance of :class:`~.operations.Gate`,
parameters are unpacked and added.
targets: list
Gate targets.
controls: list
Gate controls.
arg_value: float
Argument value(phi).
arg_label: string
targets: int or list, optional
Index for the target qubits.
controls: int or list, optional
Indices for the (quantum) control qubits.
arg_value: Any, optional
Arguments for the gate. It will be used when generating the
unitary matrix. For predefined gates, they are used when
calling the ``get_compact_qobj`` methods of a gate.
arg_label: string, optional
Label for gate representation.
index : list
index : list, optional
Positions to add the gate. Each index in the supplied list refers
to a position in the original list of gates.
classical_controls : int or list of int, optional
indices of classical bits to control gate on.
Indices of classical bits to control the gate.
control_value : int, optional
value of classical bits to control on, the classical controls are
interpreted as an integer with lowest bit being the first one.
Value of classical bits to control on, the classical controls are
interpreted as an integer with the lowest bit being the first one.
If not specified, then the value is interpreted to be
2 ** len(classical_controls) - 1
(i.e. all classical controls are 1).
Expand Down
20 changes: 10 additions & 10 deletions src/qutip_qip/compiler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,10 @@ def schedule(
repeat_num=0,
):
"""
Schedule a `QubitCircuit`,
a list of `Gates` or a list of `Instruction`.
For pulse schedule, the execution time for each `Instruction`
is given in its `duration` attributes.
Schedule a :obj:`.QubitCircuit`,
a list of :obj:`.Gates` or a list of :obj:`.Instruction`.
For pulse schedule, the execution time for each :obj:`.Instruction`
is given in its ``duration`` attributes.
The scheduler first generates a quantum gates dependency graph,
containing information about
Expand Down Expand Up @@ -398,18 +398,18 @@ def schedule(
each with an attribute `duration`
that indicates the execution time of this instruction.
gates_schedule: bool, optional
`True`, if only gates schedule is needed.
``True``, if only gates schedule is needed.
This saves some computation
that is only useful to pulse schedule.
If the input `circuit` is a `QubitCircuit`,
it will be assigned to `True` automatically.
If the input ``circuit`` is a :obj:`.QubitCircuit`,
it will be assigned to ``True`` automatically.
Otherwise, the default is `False`.
return_cycles_list: bool, optional
If `True`, the method returns the `cycles_list`,
e.g. [{0, 2}, {1, 3}],
If ``True``, the method returns the ``cycles_list``,
e.g. ``[{0, 2}, {1, 3}]``,
which means that the first cycle contains gates0 and gates2
while the second cycle contains gates1 and gates3.
It is only usefull for gates schedule.
It is only useful for gates schedule.
random_shuffle: bool, optional
If the commuting gates are randomly scuffled to explore
larger search space.
Expand Down

0 comments on commit f7bcc35

Please sign in to comment.