quri_parts.circuit.circuit_parametric module¶
- class ImmutableParametricQuantumCircuit¶
Bases:
object- bind_parameters(params)¶
- bind_parameters_by_dict(params_dict)¶
- cbit_count¶
- combine()¶
- depth¶
- draw()¶
- freeze()¶
- gates¶
- gates_and_params¶
- get_mutable_copy()¶
- has_trivial_parameter_mapping¶
- param_mapping¶
- parameter_count¶
- primitive_circuit()¶
- qubit_count¶
- sample(shot_count, params)¶
- class ParametricQuantumCircuit¶
Bases:
ImmutableParametricQuantumCircuit- add_CNOT_gate(control_index, target_index)¶
- add_CZ_gate(control_index, target_index)¶
- add_H_gate(qubit_index)¶
- add_Identity_gate(qubit_index)¶
- add_ParametricPauliRotation_gate(target_indices, pauli_ids)¶
- add_ParametricRX_gate(qubit_index)¶
- add_ParametricRY_gate(qubit_index)¶
- add_ParametricRZ_gate(qubit_index)¶
- add_Pauli_gate(target_indices, pauli_ids)¶
- add_RX_gate(qubit_index, angle)¶
- add_RY_gate(qubit_index, angle)¶
- add_RZ_gate(qubit_index, angle)¶
- add_SWAP_gate(target_index1, target_index2)¶
- add_S_gate(qubit_index)¶
- add_Sdag_gate(qubit_index)¶
- add_SingleQubitUnitaryMatrix_gate(target_index, unitary_matrix)¶
- add_SqrtX_gate(qubit_index)¶
- add_SqrtXdag_gate(qubit_index)¶
- add_SqrtY_gate(qubit_index)¶
- add_SqrtYdag_gate(qubit_index)¶
- add_TOFFOLI_gate(control_index1, control_index2, target_index)¶
- add_T_gate(qubit_index)¶
- add_Tdag_gate(qubit_index)¶
- add_TwoQubitUnitaryMatrix_gate(target_index1, target_index2, unitary_matrix)¶
- add_U1_gate(qubit_index, lmd)¶
- add_U2_gate(qubit_index, phi, lmd)¶
- add_U3_gate(qubit_index, theta, phi, lmd)¶
- add_UnitaryMatrix_gate(target_indices, unitary_matrix)¶
- add_X_gate(qubit_index)¶
- add_Y_gate(qubit_index)¶
- add_Z_gate(qubit_index)¶
- add_gate()¶
- extend()¶
- measure(qubit_indices, classical_indices)¶
- UnboundParametricQuantumCircuit¶
Deprecated use ParametricQuantumCircuit instead
- class ParametricQuantumCircuitProtocol(*args, **kwargs)¶
Bases:
QuantumCircuitProtocol,ProtocolInterface protocol for a quantum circuit containing unbound (i.e. not assigned values) parameters.
For circuit execution, the parameters need to be assigned concrete values by
bind_parameters()method.- abstract bind_parameters(params)¶
Returns a new circuit with the parameters assigned concrete values.
This method does not modify self but returns a newly created circuit.
- Parameters:
params (Sequence[float])
- Return type:
- abstract freeze()¶
Returns a “freezed” version of itself.
The “freezed” version is an immutable object and can be reused safely without copying.
- Return type:
- abstract get_mutable_copy()¶
Returns a copy of itself that can be modified.
Use this method when you want to get a new circuit based on an existing circuit but don’t want to modify it.
- Return type:
- abstract primitive_circuit()¶
Returns the parametric circuit where each gate has an independent parameter.
Note that some parametric circuit, e.g.
LinearMappedParametricQuantumCircuit, can have non-trivial mapping of the parameters. In this “primitive circuit”, however, gate parameters are treated as independent, even if those in the original circuit depend on the same parameters. For example, if the parametric circuit is defined as:\[\begin{align} U_1(f(\theta_1, \theta_2)) U_2(g(\theta_1, \theta_2)) \end{align}\]the primitive circuit should be as the following:
\[\begin{align} U_1(\psi_1) U_2(\psi_2) \end{align}\]where U1, U2 are rotation gates and f, g are parameter mappings.
- Return type:
- abstract property parameter_count: int¶
- abstract property gates: Sequence[QuantumGate | ParametricQuantumGate]¶
Returns the gate sequence of the circuit.
- abstract property has_trivial_parameter_mapping: bool¶
Returns if the input parameters are used for parametric gates without any conversions.
Note that some parametric circuit, e.g.
LinearMappedParametricQuantumCircuit, can have non- trivial mapping of the parameters.
- abstract property param_mapping: ParameterMapping¶
Returns the parameter mapping of the circuit.
- UnboundParametricQuantumCircuitProtocol¶
Deprecated: use ParametricQuantumCircuitProtocol instead
- MutableUnboundParametricQuantumCircuitProtocol¶
Deprecated: use MutableParametricQuantumCircuitProtocol instead
- class ImmutableBoundParametricQuantumCircuit(circuit, parameter_map)¶
Bases:
ImmutableQuantumCircuit- freeze()¶
- parameter_map¶
- unbound_param_circuit¶
- ImmutableUnboundParametricQuantumCircuit¶
Deprecated: use
ImmutableParametricQuantumCircuitinstead
- class MutableParametricQuantumCircuitProtocol(*args, **kwargs)¶
Bases:
ParametricQuantumCircuitProtocol,MutableQuantumCircuitProtocol,Protocol