MCPcopy
hub / github.com/Qiskit/qiskit / _append_standard_gate

Method _append_standard_gate

qiskit/circuit/quantumcircuit.py:2807–2830  ·  view source on GitHub ↗

An internal method to bypass some checking when directly appending a standard gate.

(
        self,
        op: StandardGate,
        qargs: Sequence[QubitSpecifier] = (),
        params: Sequence[ParameterValueType] = (),
        label: str | None = None,
    )

Source from the content-addressed store, hash-verified

2805 return self._data._cbit_argument_conversion(clbit_representation)
2806
2807 def _append_standard_gate(
2808 self,
2809 op: StandardGate,
2810 qargs: Sequence[QubitSpecifier] = (),
2811 params: Sequence[ParameterValueType] = (),
2812 label: str | None = None,
2813 ) -> InstructionSet:
2814 """An internal method to bypass some checking when directly appending a standard gate."""
2815 circuit_scope = self._current_scope()
2816
2817 if params is None:
2818 params = []
2819
2820 expanded_qargs = [self._qbit_argument_conversion(qarg) for qarg in qargs or []]
2821 for param in params:
2822 Gate.validate_parameter(op, param)
2823
2824 instructions = InstructionSet(resource_requester=circuit_scope.resolve_classical_resource)
2825 for qarg, _ in Gate.broadcast_arguments(op, expanded_qargs, []):
2826 self._check_dups(qarg)
2827 instruction = CircuitInstruction.from_standard(op, qarg, params, label=label)
2828 circuit_scope.append(instruction, _standard_gate=True)
2829 instructions._add_ref(circuit_scope.instructions, len(circuit_scope.instructions) - 1)
2830 return instructions
2831
2832 def append(
2833 self,

Callers 15

hMethod · 0.95
chMethod · 0.95
idMethod · 0.95
pMethod · 0.95
cpMethod · 0.95
rMethod · 0.95
rccxMethod · 0.95
rcccxMethod · 0.95
rxMethod · 0.95
crxMethod · 0.95
rxxMethod · 0.95
ryMethod · 0.95

Calls 8

_current_scopeMethod · 0.95
_check_dupsMethod · 0.95
_add_refMethod · 0.95
InstructionSetClass · 0.85
validate_parameterMethod · 0.45
broadcast_argumentsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected