quairkit.core.operator.base¶
Source file for basic operator.
- class quairkit.core.operator.base.OperatorInfoType(*args, **kwargs)¶
A dictionary storing basic information for Operator.
- Keys:
uid: Unique identifier for the operator.
name: Operator name.
- type: Operator type, can be one of:
‘general’: General operator.
‘gate’: Quantum gate.
‘channel’: Quantum channel.
‘locc’: One-way local operation and classical communication.
tex: LaTeX representation (without ‘$’).
- system_idx: Physical system index or indices the operator acts upon. Shape:
[# of operators, num_acted_system]
num_ctrl_system: Number of indices that control the operator.
label: Labels for control systems, collapse events (measurement), or measurement outcomes.
- param: Parameter tensor for parameterized operators. Shape:
[1 or len(system_idx), batch_size, num_acted_param]
param_sharing: Boolean indicating if parameters are shared. Defaults to
False.matrix: Matrix representation (if type is ‘gate’).
api: Circuit API method that invokes the operator in a circuit.
permute: Index representation for permutation operators.
kwargs: Additional keyword arguments for circuit APIs.
plot_width: Plot width (optional, default:
None).
Note
This class is used as a type hint for OperatorInfo, and should not be instantiated directly. It is designed to provide a structured way to store and access operator information in QuAIRKit.
- property qasm : str | list[str]¶
Display in OpenQASM-like format
- property qasm2 : str | list[str]¶
Display in OpenQASM 2.0 format
- quairkit.core.operator.base.qasm2_to_info(qasm2)¶
Convert an OpenQASM 2.0 string to a list of OperatorInfo instances.
- Parameters:¶
- qasm2 : str¶
A complete OpenQASM 2.0 string representing a circuit.
- Returns:¶
A list of OperatorInfo instances corresponding to the provided OpenQASM 2.0 string.
- Return type:¶
List[OperatorInfoType]