qat.ir.gates.gates_2q module
- class CNOT(**data)
Bases:
ControlGate2Q
Implements a CNOT with the control gate on :param:`qubit1` and target gate on :param:`qubit2`.
Matrix representation:
\[\begin{split}{\rm CNOT}_{c, t} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix}\end{split}\]Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
-
inst:
Literal
['CNOT'
]
- property matrix
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
inst:
- class CPhase(**data)
Bases:
ControlGate2Q
Implements the controlled-\(Phase\) gate.
Unlike the non-controlled gate, note that this is not equivalent to the \(CR_{z}(\theta)\) gate.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
-
inst:
Literal
['CPhase'
]
- property matrix
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
theta:
Annotated
[float
]
-
inst:
- class CRx(**data)
Bases:
ControlGate2Q
Implements the controlled-\(R_{x}(\theta)\) gate.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
-
inst:
Literal
['CRx'
]
- property matrix
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
theta:
Annotated
[float
]
-
inst:
- class CRy(**data)
Bases:
ControlGate2Q
Implements the controlled-\(R_{y}(\theta)\) gate.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
-
inst:
Literal
['CRy'
]
- property matrix
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
theta:
Annotated
[float
]
-
inst:
- class CRz(**data)
Bases:
ControlGate2Q
Implements the controlled-\(R_{z}(\theta)\) gate.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
-
inst:
Literal
['CRz'
]
- property matrix
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
theta:
Annotated
[float
]
-
inst:
- class ControlGate2Q(**data)
Bases:
Gate2Q
,ABC
Base class for controlled two-qubit gates. The convention is
qubit1
is the control qubit andqubit
is the target qubit. For some single qubit gate \(G\), the controlled gate is\[CG = \ket{1}\bra{1} \otimes G + \ket{0}\bra{0} \otimes I\]Will eventually be replaced by a mechanism for creating control gates from standard gates. Used now to mark gates as control gates (which will be considered in future optimisation passes).
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- property control
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property target
- class ECR(**data)
Bases:
Gate2Q
Implements the ECR gate.
Matrix representation:
\[\begin{split}{\rm ECR} = \begin{bmatrix} 0 & 0 & 1 & i \\ 0 & 0 & i & 1 \\ 1 & -i & 0 & 0 \\ -i & 1 & 0 & 0 \end{bmatrix}\end{split}\]Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
-
inst:
Literal
['ECR'
]
- property matrix
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
inst:
- class Gate2Q(**data)
Bases:
GateBase
,ABC
Base gate for two qubit operations.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- abstract property matrix
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
qubit1:
Annotated
[int
]
-
qubit2:
Annotated
[int
]
- property qubits
- class SWAP(**data)
Bases:
Gate2Q
Implements the SWAP gate.
Matrix representation:
\[\begin{split}{\rm SWAP} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\end{split}\]Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
-
inst:
Literal
['SWAP'
]
- property matrix
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
inst: