quairkit.core.operator

Basic operator.

class quairkit.core.operator.Operator(backend=None, dtype=None)

The basic class to implement the operation in QuAIRKit.

Parameters:
backend : Backend | None

The backend implementation of the operator. Defaults to None, which means to use the default backend implementation.

dtype : str | None

The data type of the operator. Defaults to None, which means to use the default data type.

property info : OperatorInfoType

Information of this operator.

class quairkit.core.operator.OperatorInfoType

A dictionary storing basic information for Operator.

Keys:
  • 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).