qrunch.quantum.gates.annotation_gates
Annotation gates.
Classes
Apply a global phase to the system. |
- class GlobalPhase
Bases:
AnnotationGateApply a global phase to the system.
All fields are immutable (
frozen=True) so an instance can be safely reused.- Parameters:
phase – The global phase.
- __init__(phase: complex) None
- Parameters:
phase (complex)
- Return type:
None
- commutes_with_pauli_string(pauli_string: PauliString) bool
Check if gate commutes with the given pauli string. Default is False.
The default implementation always returns False. So False is considered a safe answer. An only True should be trusted.
- Parameters:
pauli_string (PauliString) – Pauli string to check commutation for.
- Return type:
bool
- flatten() Iterator[Gate]
Flatten the gate into a list of primitive gates.
- Return type:
Iterator[Gate]
- invert() GlobalPhase
Get the inverse of the gate.
- Return type:
- is_fully_specified() bool
Check if all parameters have been specified.
- Return type:
bool
- property parameters: list[float | Parameter | ParameterExpression]
List of all parameters available.
- phase: complex
- property qubit_indices: tuple[int, ...]
Indices of the qubits that gate is working on.
- relocate(new_indices: Mapping[int, int]) Self
Relocate the gate to new qubit indices.
- Parameters:
new_indices (Mapping[int, int])
- Return type:
Self
- symbols(*, max_number_of_decimals: int | None = None) list[str]
Symbols for represent the gate in a circuit.
- Parameters:
max_number_of_decimals (int | None) – Maximum number of decimals to use for floats in the symbols. Defaults to None.
- Return type:
list[str]
- with_specified_parameters(parameter_value_pairs: dict[Parameter, float | ParameterExpression]) Self
Create a new gate with the specified parameters.
- Parameters:
parameter_value_pairs (dict[Parameter, float | ParameterExpression]) – Mapping between parameters and their values.
- Returns:
New gate with the parameters specified.
- Return type:
Self