InstructionDurations#

class qiskit.transpiler.InstructionDurations(instruction_durations=None, dt=None)[소스]#

기반 클래스: object

Helper class to provide durations of instructions for scheduling.

It stores durations (gate lengths) and dt to be used at the scheduling stage of transpiling. It can be constructed from backend or instruction_durations, which is an argument of transpile(). The duration of an instruction depends on the instruction (given by name), the qubits, and optionally the parameters of the instruction. Note that these fields are used as keys in dictionaries that are used to retrieve the instruction durations. Therefore, users must use the exact same parameter value to retrieve an instruction duration as the value with which it was added.

Methods

classmethod from_backend(backend)[소스]#

Construct an InstructionDurations object from the backend.

매개변수:

backend (Backend) – backend from which durations (gate lengths) and dt are extracted.

반환:

The InstructionDurations constructed from backend.

반환 형식:

InstructionDurations

예외 발생:

TranspilerError – If dt and dtm is different in the backend.

get(inst, qubits, unit='dt', parameters=None)[소스]#

Get the duration of the instruction with the name, qubits, and parameters.

Some instructions may have a parameter dependent duration.

버전 0.19.0부터 폐지됨: Using a Qubit or List[Qubit] for the qubits argument to InstructionDurations.get() is deprecated as of qiskit-terra 0.19.0. It will be removed no earlier than 3 months after the release date. Instead, use an integer for the qubit index.

매개변수:
  • inst (str | qiskit.circuit.Instruction) – An instruction or its name to be queried.

  • qubits (int | list[int] | Qubit | list[Qubit] | list[int | Qubit]) – Qubits or its indices that the instruction acts on.

  • unit (str) – The unit of duration to be returned. It must be ‘s’ or ‘dt’.

  • parameters (list[float] | None) – The value of the parameters of the desired instruction.

반환:

The duration of the instruction on the qubits.

반환 형식:

float|int

예외 발생:

TranspilerError – No duration is defined for the instruction.

units_used()[소스]#

Get the set of all units used in this instruction durations.

반환:

Set of units used in this instruction durations.

반환 형식:

set[str]

update(inst_durations, dt=None)[소스]#

Update self with inst_durations (inst_durations overwrite self).

매개변수:
  • inst_durations ('InstructionDurationsType' | None) – Instruction durations to be merged into self (overwriting self).

  • dt (float) – Sampling duration in seconds of the target backend.

반환:

The updated InstructionDurations.

반환 형식:

InstructionDurations

예외 발생:

TranspilerError – If the format of instruction_durations is invalid.