pub struct Matchgate { /* private fields */ }Expand description
Defines a matchgate operator.
A two-qubit operator that applies a matchgate transformation to the adjacent target qubits. This gate can be decomposed into a two-qubit rotation and phase shifts. It is designed to simulate nearest-neighbor interactions in fermionic systems.
It resembles the matrix operator:
[1 0 0 0; 0 cos(theta/2) -e^(i*phi1)sin(theta/2) 0; 0 sin(theta/2) e^(i*phi2)cos(theta/2) 0; 0 0 0 e^(i*phi2)]§Warning
This gate is not yet compilable to OpenQASM, since it requires advanced decomposition techniques.
Implementations§
Trait Implementations§
Source§impl Operator for Matchgate
impl Operator for Matchgate
Source§fn apply(
&self,
state: &State,
target_qubit: &[usize],
control_qubits: &[usize],
) -> Result<State, Error>
fn apply( &self, state: &State, target_qubit: &[usize], control_qubits: &[usize], ) -> Result<State, Error>
Applies the matchgate operator to the given state’s target qubit and its adjacent qubit.
§Arguments:
-
state- The state to apply the operator to. -
target_qubit- The target qubit to apply the operator to. The adjacent is automatically determined as the next 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 matchgate operator.
§Errors:
-
Error::InvalidNumberOfQubits- If the number of target qubits is not 1. -
Error::InvalidQubitIndex- If the target qubit indices are invalid for the number of qubits in the state, or if the target qubit is the last qubit. -
Error::OverlappingControlAndTargetQubits- If the control qubit and target qubit indices overlap.
Source§fn base_qubits(&self) -> usize
fn base_qubits(&self) -> usize
Source§fn to_compilable(&self) -> Option<&dyn Compilable>
fn to_compilable(&self) -> Option<&dyn Compilable>
impl Copy for Matchgate
Auto Trait Implementations§
impl Freeze for Matchgate
impl RefUnwindSafe for Matchgate
impl Send for Matchgate
impl Sync for Matchgate
impl Unpin for Matchgate
impl UnwindSafe for Matchgate
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