controlled_operator

Define controlled operators.

The state of one or more control qubits controls whether a certain operator acts on one or more target qubits.

class parityos.operators.controlled_operator.TargetT

A TypeVar representing valid target operators for a ControlledOperator.

alias of TypeVar(‘TargetT’, bound=ConcreteOperator[QubitT] | RotationOperator[QubitT, HermitianOperator[QubitT]] | OperatorProduct[ConcreteOperator[QubitT] | RotationOperator[QubitT, HermitianOperator[QubitT]]])

class parityos.operators.controlled_operator.TargetT_co

A covariant TypeVar representing valid target operators for a ControlledOperator.

alias of TypeVar(‘TargetT_co’, bound=ConcreteOperator[QubitT] | RotationOperator[QubitT, HermitianOperator[QubitT]] | OperatorProduct[ConcreteOperator[QubitT] | RotationOperator[QubitT, HermitianOperator[QubitT]]], covariant=True)

class parityos.operators.controlled_operator.ControlledOperator

Bases: Operator[QubitT_co], HasFrozenQubits[QubitT_co], Parameterized, Generic[QubitT_co, TargetT_co], ABC

Abstract base class for a controlled operator, where the state of one or more control qubits controls whether a target operator acts on one or more target qubits.

Note

Controlled operators are always symmetric under the permutation of their control qubits, so there is no ordered_control_qubits field.

property target_operator: TargetT_co

Operator acting on target qubits depending on the state of the control qubits.

property control_qubits: frozenset[QubitT_co]

Qubits that control whether the target operator is executed.

property target_qubits: frozenset[QubitT_co]

Unordered set of Qubits the target operator acts on.

property ordered_target_qubits: tuple[QubitT_co, ...]

Ordered sequence of Qubits the target operator acts on.

decompose() Iterator[ControlledOperator[QubitT_co, ConcreteOperator[QubitT_co] | RotationOperator[QubitT_co, HermitianOperator[QubitT_co]] | OperatorProduct[ConcreteOperator[QubitT_co] | RotationOperator[QubitT_co, HermitianOperator[QubitT_co]]]] | Self]

Decompose a controlled tensor product (OperatorProduct) into an iterator of controlled single operator elements of the tensor product.

The returned iterator represents the (commuting) sequence of resulting controlled single operator targets.

Note

If target_operator is not a tensor product, this method just yields self.

Examples

>>> # C(Z(0)X(1)) -> CZ(0) * CX(1)
>>> assert list(
>>>     GeneralControlledOperator(Z(get_q(0)) * X(get_q(1)), get_q("c")).decompose()
>>> ) == [CZ(get_q("c"), get_q(0)), CNOT(get_q("c"), get_q(1))]
>>>
>>> # If the target is not a tensor product, self is yielded.
>>> assert list(CNOT(get_q(0), get_q(1)).decompose()) == [CNOT(get_q(0), get_q(1))]
Yields:

Controlled single operator element of controlled tensor product

property qubits: frozenset[QubitT_co]

Combined unordered set of control and target qubits.

property ordered_qubits: tuple[QubitT_co, ...]

Combined ordered sequence of control and target qubits.

Control qubits come before target qubits.

property is_hermitian: bool

Whether this operator is hermitian.

class parityos.operators.controlled_operator.GeneralControlledOperator(control_qubits: QubitT_co | Collection[QubitT_co], target_operator: ConcreteOperator[QubitT_co] | RotationOperator[QubitT_co, HermitianOperator[QubitT_co]] | OperatorProduct[ConcreteOperator[QubitT_co] | RotationOperator[QubitT_co, HermitianOperator[QubitT_co]]])

Bases: ControlledOperator[QubitT_co, ConcreteOperator[QubitT_co] | RotationOperator[QubitT_co, HermitianOperator[QubitT_co]] | OperatorProduct[ConcreteOperator[QubitT_co] | RotationOperator[QubitT_co, HermitianOperator[QubitT_co]]]], HasFrozenUnorderedQubits[QubitT_co]

General controlled operator taking any target operator and turning it into a ControlledOperator with an arbitrary amount of control qubits.

Note

If the target operator and number of control qubits correspond to any of the concrete implementations below, an instance of the respective concrete operator class is created instead.

Examples

>>> op = GeneralControlledOperator(Z(get_q(0)), get_q(1))
>>> assert type(op).__name__ == "CZ"
>>> op = GeneralControlledOperator(RX(get_q(0)), get_q(1))
>>>  assert type(op).__name__ == "CRX"
>>> # not a known concrete controlled operator
>>> op = GeneralControlledOperator(X(get_q(0))*Y(get_q(1)), (get_q(2), get_q(3)))
>>> assert type(op).__name__ == "GeneralControlledOperator"
Raises:
control_qubits: frozenset[QubitT_co]

The control qubits controlling whether target_operator is applied.

target_operator: ConcreteOperator[QubitT_co] | RotationOperator[QubitT_co, HermitianOperator[QubitT_co]] | OperatorProduct[ConcreteOperator[QubitT_co] | RotationOperator[QubitT_co, HermitianOperator[QubitT_co]]]

The target operator that is controlled by the control_qubits.

target_qubits: frozenset[QubitT_co]
ordered_target_qubits: tuple[QubitT_co, ...]
get_hermitian_conjugate() Self

Return the hermitian conjugate (\(\dagger\)) of this operator.

parameters: frozenset[Parameter]
substitute_parameters(old_to_new: Mapping[Parameter, Symbolic | complex]) Self

Substitute symbolic parameters with new symbolic expressions or numeric values.

Parameters:

old_to_new – Mapping from existing parameter symbols to new values (numeric or symbolic).

Returns:

Copy of self with replaced parameters.

property name: str

Dynamically generated name for this operator.

Where applicable the name must coincide with the OpenQASM standard.

parityos.operators.controlled_operator.get_concrete_controlled_from_target(controlled_type: type[ConcreteControlledOperator[Qubit, TargetT]], target_operator: TargetT, control_qubits: Collection[Qubit]) ConcreteControlledOperator[Qubit, TargetT]

Create a concrete controlled operator from an instance of its target type and control qubits.

Disambiguates between different types of concrete controlled operators with different __init__ signatures and calls the correct constructor based on the input.

Parameters:
  • controlled_type – Concrete controlled operator type to create.

  • target_operator – Target operator of the concrete controlled operator to create.

  • control_qubits – Control qubits of the concrete controlled operator to create.

Returns:

The concrete controlled operator created from target_operator and control_qubits.

Raises:

ParityOSNotSupportedError – If the construction of the concrete controlled operator from target_operator and control_qubits is not implemented.

class parityos.operators.controlled_operator.ConcreteControlledOperator

Bases: ControlledOperator[QubitT_co, TargetT_co], ConcreteOperator[QubitT_co], ABC

Interface for concrete, named controlled operators, such as CX, CZ, CRZ, CCX etc.

Implementations define their target operator type and amount of qubits as class variables and only take qubits (and potentially angles) at initialization.

target_type: ClassVar[type[TargetT_co]]

Type of the target operator

n_control: ClassVar[int]

Number of control qubits

n_target: ClassVar[int]

Number of target qubits

property target_operator: TargetT_co

Concrete instance of the target operator.

abstractmethod classmethod from_qubits(qubits: Sequence[QubitT_co]) Self

Return an instance of this controlled operator from an ordered sequence of qubits, which is a concatenation of control and target qubits.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

property name: str

Dynamically generated name for this operator.

Where applicable the name must coincide with the OpenQASM standard.

class parityos.operators.controlled_operator.HasSingleControlQubit(control_qubit: QubitT_co)

Bases: ConcreteControlledOperator[QubitT_co, TargetT_co], ABC

Mixin that adds a control_qubit attribute.

control_qubit: QubitT_co

The single control qubit this operator acts on.

property control_qubits: frozenset[QubitT_co]

Qubits that control whether the target operator is executed.

class parityos.operators.controlled_operator.HasMultiControlQubits(control_qubits: QubitT_co | Iterable[QubitT_co])

Bases: ConcreteControlledOperator[QubitT_co, TargetT_co], ABC

Mixin that implements control_qubits as an attribute.

class parityos.operators.controlled_operator.HasSingleTargetQubit(target_qubit: QubitT_co)

Bases: ConcreteControlledOperator[QubitT_co, SingleQubitOperatorT_co], ABC

Mixin that adds a target_qubit attribute.

target_qubit: QubitT_co

The single target qubit this operator acts on.

property target_qubits: frozenset[QubitT_co]

Unordered set of Qubits the target operator acts on.

property ordered_target_qubits: tuple[QubitT_co, ...]

Ordered sequence of Qubits the target operator acts on.

class parityos.operators.controlled_operator.HasOrderedMultiTargetQubits(ordered_target_qubits)

Bases: ConcreteControlledOperator[QubitT_co, OrderedMultiQubitOperatorT_co], ABC

Mixin that implements ordered_target_qubits as an attribute.

property target_qubits: frozenset[QubitT_co]

Unordered set of Qubits the target operator acts on.

class parityos.operators.controlled_operator.HasUnorderedMultiTargetQubits(target_qubits)

Bases: ConcreteControlledOperator[QubitT_co, UnorderedMultiQubitOperatorT_co], ABC

Mixin that implements target_qubits as an attribute.

property ordered_target_qubits: tuple[QubitT_co, ...]

Ordered sequence of Qubits the target operator acts on.

class parityos.operators.controlled_operator.SingleControlSingleTarget(control_qubit: QubitT_co, target_qubit: QubitT_co)

Bases: HasSingleTargetQubit[QubitT_co, SingleQubitOperatorT_co], HasSingleControlQubit[QubitT_co, SingleQubitOperatorT_co], ABC

Interface for controlled operators with a single control qubit and a single target qubit.

n_target: ClassVar[int] = 1

Number of target qubits

n_control: ClassVar[int] = 1

Number of control qubits

property target_operator: SingleQubitOperatorT_co

Concrete instance of the target operator.

classmethod from_qubits(qubits: Sequence[QubitT_co]) Self

Return an instance of this controlled operator from an ordered sequence of qubits, which is a concatenation of control and target qubits.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

class parityos.operators.controlled_operator.MultiControlSingleTarget(control_qubits: QubitT_co | Iterable[QubitT_co], target_qubit: QubitT_co)

Bases: HasSingleTargetQubit[QubitT_co, SingleQubitOperatorT_co], HasMultiControlQubits[QubitT_co, SingleQubitOperatorT_co], ABC

Interface for controlled operators with multiple control qubits and a single target qubit.

n_target: ClassVar[int] = 1

Number of target qubits

property target_operator: SingleQubitOperatorT_co

Concrete instance of the target operator.

classmethod from_qubits(qubits: Sequence[QubitT_co]) Self

Return an instance of this controlled operator from an ordered sequence of qubits, which is a concatenation of control and target qubits.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

class parityos.operators.controlled_operator.SingleControlOrderedMultiTarget(control_qubit: QubitT_co, ordered_target_qubits)

Bases: HasOrderedMultiTargetQubits[QubitT_co, OrderedMultiQubitOperatorT_co], HasSingleControlQubit[QubitT_co, OrderedMultiQubitOperatorT_co], ABC

Interface for controlled operators with a single control qubit and an ordered sequence of target qubits.

n_control: ClassVar[int] = 1

Number of control qubits

property target_operator: OrderedMultiQubitOperatorT_co

Concrete instance of the target operator.

classmethod from_qubits(qubits: Sequence[QubitT_co]) Self

Return an instance of this controlled operator from an ordered sequence of qubits, which is a concatenation of control and target qubits.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

class parityos.operators.controlled_operator.SingleControlUnorderedMultiTarget(control_qubit: QubitT_co, target_qubits)

Bases: HasUnorderedMultiTargetQubits[QubitT_co, UnorderedMultiQubitOperatorT_co], HasSingleControlQubit[QubitT_co, UnorderedMultiQubitOperatorT_co], ABC

Interface for controlled operators with a single control qubit acting on an unordered set of target qubits.

n_control: ClassVar[int] = 1

Number of control qubits

property target_operator: UnorderedMultiQubitOperatorT_co

Concrete instance of the target operator.

classmethod from_qubits(qubits: Sequence[QubitT_co]) Self

Return an instance of this controlled operator from an ordered sequence of qubits, which is a concatenation of control and target qubits.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

class parityos.operators.controlled_operator.ControlledRotation(angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: HasAngle, ConcreteControlledOperator[QubitT_co, SingleAngleRotationT_co], ABC

Interface for controlled operators with a target operator that is a single-angle rotation operator (SingleAngleRotation).

get_hermitian_conjugate() Self

Return the hermitian conjugate (\(\dagger\)) of this operator.

property parameters: frozenset[Parameter]

The symbolic parameters parameterizing this object.

substitute_parameters(old_to_new: Mapping[Parameter, Symbolic | complex]) Self

Substitute symbolic parameters with new symbolic expressions or numeric values.

Parameters:

old_to_new – Mapping from existing parameter symbols to new values (numeric or symbolic).

Returns:

Copy of self with replaced parameters.

abstractmethod classmethod from_qubits_and_angle(qubits: Sequence[QubitT_co], angle: Symbolic | complex) Self

Return an instance of this controlled rotation from an ordered sequence of qubits, which is a concatenation of control and target qubits, and an angle.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

class parityos.operators.controlled_operator.SingleControlSingleTargetRotation(control_qubit: QubitT_co, target_qubit: QubitT_co, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: ControlledRotation[QubitT_co, SingleQubitRotationT_co], SingleControlSingleTarget[QubitT_co, SingleQubitRotationT_co], ABC

Interface for controlled rotation operators with a single control and target qubit.

Examples: CRX, CRY, CRZ

target_operator
classmethod from_qubits_and_angle(qubits: Sequence[QubitT_co], angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True))) Self

Return an instance of this controlled rotation from an ordered sequence of qubits, which is a concatenation of control and target qubits, and an angle.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

class parityos.operators.controlled_operator.MultiControlSingleTargetRotation(control_qubits: QubitT_co | Iterable[QubitT_co], target_qubit: QubitT_co, angle: Coefficient = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: ControlledRotation[QubitT_co, SingleQubitRotationT_co], MultiControlSingleTarget[QubitT_co, SingleQubitRotationT_co], ABC

Interface for controlled rotation operators with a multiple control and a single target qubit.

Examples: CCRX, CCRY, CCRZ

target_operator
classmethod from_qubits_and_angle(qubits: Sequence[QubitT_co], angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True))) Self

Return an instance of this controlled rotation from an ordered sequence of qubits, which is a concatenation of control and target qubits, and an angle.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

class parityos.operators.controlled_operator.SingleControlUnorderedMultiTargetRotation(control_qubit: QubitT_co, target_qubits, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: ControlledRotation[QubitT_co, UnorderedMultiQubitRotationT_co], SingleControlUnorderedMultiTarget[QubitT_co, UnorderedMultiQubitRotationT_co], ABC

Interface for controlled rotation operators with a single control and an unordered set of target qubits.

Examples: CRXX, CRYY, CRZZ

target_operator
classmethod from_qubits_and_angle(qubits: Sequence[QubitT_co], angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True))) Self

Return an instance of this controlled rotation from an ordered sequence of qubits, which is a concatenation of control and target qubits, and an angle.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

class parityos.operators.controlled_operator.SingleControlOrderedMultiTargetRotation(control_qubit: QubitT_co, ordered_target_qubits, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: ControlledRotation[QubitT_co, OrderedMultiQubitT_co], SingleControlOrderedMultiTarget[QubitT_co, OrderedMultiQubitT_co], ABC

Interface for controlled rotation operators with a single control and an ordered sequence of target qubits.

Examples: CRXZ

target_operator
classmethod from_qubits_and_angle(qubits: Sequence[QubitT_co], angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True))) Self

Return an instance of this controlled rotation from an ordered sequence of qubits, which is a concatenation of control and target qubits, and an angle.

Control qubits must come before target qubits. The order of control qubits doesn’t matter, while the order of target qubits might matter, depending on whether the target operator is symmetric in its qubits.

final class parityos.operators.controlled_operator.CX(control_qubit: QubitT_co, target_qubit: QubitT_co)

Bases: SingleControlSingleTarget[QubitT_co, X[QubitT_co]], HasNoParameters, HermitianOperator[QubitT_co]

Controlled X operator, also known as CNOT gate.

\[\mathrm{CX} = \exp\left(i \frac{\pi}{4} (I-Z) \otimes (1-X) \right).\]
n_qubits: ClassVar[int] = 2

The number of qubits this operator acts on. Implementing classes define this as static class variable.

target_type

alias of X

parityos.operators.controlled_operator.CNOT

alias of CX

final class parityos.operators.controlled_operator.CY(control_qubit: QubitT_co, target_qubit: QubitT_co)

Bases: SingleControlSingleTarget[QubitT_co, Y[QubitT_co]], HasNoParameters, HermitianOperator[QubitT_co]

Controlled Y operator.

\[\mathrm{CY} = \exp\left(i \frac{\pi}{4} (I-Z) \otimes (1-Y) \right).\]
n_qubits: ClassVar[int] = 2

The number of qubits this operator acts on. Implementing classes define this as static class variable.

target_type

alias of Y

final class parityos.operators.controlled_operator.CZ(control_qubit: QubitT_co, target_qubit: QubitT_co)

Bases: SingleControlSingleTarget[QubitT_co, Z[QubitT_co]], HasNoParameters, HermitianOperator[QubitT_co]

Controlled Z operator.

\[\mathrm{CZ} = \exp\left(i \frac{\pi}{4} (I-Z) \otimes (1-Z) \right).\]
n_qubits: ClassVar[int] = 2

The number of qubits this operator acts on. Implementing classes define this as static class variable.

target_type

alias of Z

final class parityos.operators.controlled_operator.CCX(control_qubits: QubitT_co | Iterable[QubitT_co], target_qubit: QubitT_co)

Bases: MultiControlSingleTarget[QubitT_co, X[QubitT_co]], HasNoParameters, HermitianOperator[QubitT_co]

Double controlled X operator, also known as Toffoli gate.

\[\mathrm{CCX} = \exp\left(i \frac{\pi}{8} (I-Z) \otimes (I-Z) \otimes (1-X) \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_control: ClassVar[int] = 2

Number of control qubits

target_type

alias of X

parityos.operators.controlled_operator.CCNOT

alias of CCX

parityos.operators.controlled_operator.Toffoli

alias of CCX

final class parityos.operators.controlled_operator.CCY(control_qubits: QubitT_co | Iterable[QubitT_co], target_qubit: QubitT_co)

Bases: MultiControlSingleTarget[QubitT_co, Y[QubitT_co]], HasNoParameters, HermitianOperator[QubitT_co]

Double controlled Y operator.

\[\mathrm{CCY} = \exp\left(i \frac{\pi}{8} (I-Z) \otimes (I-Z) \otimes (1-Y) \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_control: ClassVar[int] = 2

Number of control qubits

target_type

alias of Y

final class parityos.operators.controlled_operator.CCZ(control_qubits: QubitT_co | Iterable[QubitT_co], target_qubit: QubitT_co)

Bases: MultiControlSingleTarget[QubitT_co, Z[QubitT_co]], HasNoParameters, HermitianOperator[QubitT_co]

Double controlled Z operator.

\[\mathrm{CCZ} = \exp\left(i \frac{\pi}{8} (I-Z) \otimes (I-Z) \otimes (1-Z) \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_control: ClassVar[int] = 2

Number of control qubits

target_type

alias of Z

final class parityos.operators.controlled_operator.CRX(control_qubit: QubitT_co, target_qubit: QubitT_co, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: SingleControlSingleTargetRotation[QubitT_co, RX[QubitT_co]]

Controlled RX rotation.

\[\mathrm{CRX}(\theta) = \exp\left(-i \frac{\theta}{4} (I-Z) \otimes X \right).\]
n_qubits: ClassVar[int] = 2

The number of qubits this operator acts on. Implementing classes define this as static class variable.

target_type

alias of RX

final class parityos.operators.controlled_operator.CRY(control_qubit: QubitT_co, target_qubit: QubitT_co, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: SingleControlSingleTargetRotation[QubitT_co, RY[QubitT_co]]

Controlled RY rotation.

\[\mathrm{CRY}(\theta) = \exp\left(-i \frac{\theta}{4} (I-Z) \otimes Y \right).\]
n_qubits: ClassVar[int] = 2

The number of qubits this operator acts on. Implementing classes define this as static class variable.

target_type

alias of RY

final class parityos.operators.controlled_operator.CRZ(control_qubit: QubitT_co, target_qubit: QubitT_co, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: SingleControlSingleTargetRotation[QubitT_co, RZ[QubitT_co]]

Controlled RZ rotation.

\[\mathrm{CRZ}(\theta) = \exp\left(-i \frac{\theta}{4} (I-Z) \otimes Z \right).\]
n_qubits: ClassVar[int] = 2

The number of qubits this operator acts on. Implementing classes define this as static class variable.

target_type

alias of RZ

final class parityos.operators.controlled_operator.CCRX(control_qubits: QubitT_co | Iterable[QubitT_co], target_qubit: QubitT_co, angle: Coefficient = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: MultiControlSingleTargetRotation[QubitT_co, RX[QubitT_co]]

Double controlled RX rotation.

\[\mathrm{CCRX}(\theta) = \exp\left(-i \frac{\theta}{8} (I-Z) \otimes (I-Z) \otimes X \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_control: ClassVar[int] = 2

Number of control qubits

target_type

alias of RX

final class parityos.operators.controlled_operator.CCRY(control_qubits: QubitT_co | Iterable[QubitT_co], target_qubit: QubitT_co, angle: Coefficient = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: MultiControlSingleTargetRotation[QubitT_co, RY[QubitT_co]]

Double controlled RY rotation.

\[\mathrm{CCRY}(\theta) = \exp\left(-i \frac{\theta}{8} (I-Z) \otimes (I-Z) \otimes Y \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_control: ClassVar[int] = 2

Number of control qubits

target_type

alias of RY

final class parityos.operators.controlled_operator.CCRZ(control_qubits: QubitT_co | Iterable[QubitT_co], target_qubit: QubitT_co, angle: Coefficient = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: MultiControlSingleTargetRotation[QubitT_co, RZ[QubitT_co]]

Double controlled RZ rotation.

\[\mathrm{CCRZ}(\theta) = \exp\left(-i \frac{\theta}{8} (I-Z) \otimes (I-Z) \otimes Z \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_control: ClassVar[int] = 2

Number of control qubits

target_type

alias of RZ

final class parityos.operators.controlled_operator.CRXX(control_qubit: QubitT_co, target_qubits, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: SingleControlUnorderedMultiTargetRotation[QubitT_co, RXX[QubitT_co]]

Controlled two-qubit RXX rotation.

\[\mathrm{CRXX}(\theta) = \exp\left(-i \frac{\theta}{4} (I-Z) \otimes X \otimes X \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_target: ClassVar[int] = 2

Number of target qubits

target_type

alias of RXX

final class parityos.operators.controlled_operator.CRYY(control_qubit: QubitT_co, target_qubits, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: SingleControlUnorderedMultiTargetRotation[QubitT_co, RYY[QubitT_co]]

Controlled two-qubit RYY rotation.

\[\mathrm{CRYY}(\theta) = \exp\left(-i \frac{\theta}{4} (I-Z) \otimes Y \otimes Y \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_target: ClassVar[int] = 2

Number of target qubits

target_type

alias of RYY

final class parityos.operators.controlled_operator.CRZZ(control_qubit: QubitT_co, target_qubits, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: SingleControlUnorderedMultiTargetRotation[QubitT_co, RZZ[QubitT_co]]

Controlled two-qubit RZZ rotation.

\[\mathrm{CRZZ}(\theta) = \exp\left(-i \frac{\theta}{4} (I-Z) \otimes Z \otimes Z \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_target: ClassVar[int] = 2

Number of target qubits

target_type

alias of RZZ

final class parityos.operators.controlled_operator.CRXZ(control_qubit: QubitT_co, ordered_target_qubits, angle: Symbolic | complex = Parameter(name='DEFAULT_ANGLE', assumptions=ParameterAssumptions(zero=None, nonzero=None, positive=None, negative=None, rational=None, irrational=None, integer=None, even=None, odd=None, real=True, finite=True)))

Bases: SingleControlOrderedMultiTargetRotation[QubitT_co, RXZ[QubitT_co]]

Controlled two-qubit RXZ rotation.

\[\mathrm{CRXZ}(\theta) = \exp\left(-i \frac{\theta}{4} (I-Z) X \otimes Z \right).\]
n_qubits: ClassVar[int] = 3

The number of qubits this operator acts on. Implementing classes define this as static class variable.

n_target: ClassVar[int] = 2

Number of target qubits

target_type

alias of RXZ