pub struct PhaseShift { /* private fields */ }Expand description
Defines the phase shift operator
A single-qubit operator that applies a phase shift of the provided angle to the |1> state. Also known as the phase shift gate.
Implementations§
Trait Implementations§
Source§impl Clone for PhaseShift
impl Clone for PhaseShift
Source§fn clone(&self) -> PhaseShift
fn clone(&self) -> PhaseShift
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PhaseShift
impl Debug for PhaseShift
Source§impl Operator for PhaseShift
impl Operator for PhaseShift
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 phase shift 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 phase shift operator.
§Errors:
-
Error::InvalidNumberOfQubits- If the target qubits is not 1. -
Error::InvalidQubitIndex- If the target qubit index or control 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
impl Copy for PhaseShift
Auto Trait Implementations§
impl Freeze for PhaseShift
impl RefUnwindSafe for PhaseShift
impl Send for PhaseShift
impl Sync for PhaseShift
impl Unpin for PhaseShift
impl UnwindSafe for PhaseShift
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
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>
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>
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