pub enum Pauli {
X,
Y,
Z,
}Expand description
Defines the Pauli operators: X, Y, Z.
Variants§
Implementations§
Source§impl Pauli
impl Pauli
Sourcepub fn to_pauli_string(&self, target_qubit: usize) -> PauliString
pub fn to_pauli_string(&self, target_qubit: usize) -> PauliString
Returns the Pauli string representation of the operator.
§Returns
- A Pauli string with the specified Pauli operator on the target qubit and a coefficient of 1.0.
Trait Implementations§
Source§impl Operator for Pauli
impl Operator for Pauli
Source§fn apply(
&self,
state: &State,
target_qubits: &[usize],
control_qubits: &[usize],
) -> Result<State, Error>
fn apply( &self, state: &State, target_qubits: &[usize], control_qubits: &[usize], ) -> Result<State, Error>
Applies the Pauli operator to the given state’s target qubit.
§Arguments:
-
state- The state to apply the operator to. -
target_qubits- The target qubits to apply the operator to. This should be a single qubit. -
control_qubits- The control qubits for the operator. If not empty, the operator will be applied conditionally based on the control qubits. Otherwise, it will be applied unconditionally.
§Returns:
- The new state after applying the Pauli operator.
§Errors:
-
Error::InvalidNumberOfQubits- If the number of target qubits is not 1. -
Error::InvalidQubitIndex- If the target qubit index is invalid for the number of qubits in the state. -
Error::OverlappingControlAndTargetQubits- If the control qubit and target qubit indices overlap.
Source§fn base_qubits(&self) -> usize
fn base_qubits(&self) -> usize
Returns the number of qubits that the operator acts on. Read more
Source§fn to_compilable(&self) -> Option<&dyn Compilable>
fn to_compilable(&self) -> Option<&dyn Compilable>
Optionally returns an intermediate representation of the operator for compilation to OpenQASM. Read more
impl Copy for Pauli
impl StructuralPartialEq for Pauli
Auto Trait Implementations§
impl Freeze for Pauli
impl RefUnwindSafe for Pauli
impl Send for Pauli
impl Sync for Pauli
impl Unpin for Pauli
impl UnwindSafe for Pauli
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more