pub struct GroverOracle {
pub target: usize,
}Expand description
A Grover oracle that marks a single target basis state.
The oracle implements the phase-flip O|x⟩ = -|x⟩ if x == target, else |x⟩.
Fields§
§target: usizeThe target basis state (integer index).
Implementations§
Source§impl GroverOracle
impl GroverOracle
Sourcepub fn apply(&self, reg: &mut QuantumRegister)
pub fn apply(&self, reg: &mut QuantumRegister)
Apply the oracle phase-flip to the register amplitudes.
Sourcepub fn diffusion(reg: &mut QuantumRegister)
pub fn diffusion(reg: &mut QuantumRegister)
Apply the Grover diffusion operator (inversion about the mean) to the register.
Sourcepub fn run_grover(&self, n_qubits: usize, iterations: u32) -> QuantumRegister
pub fn run_grover(&self, n_qubits: usize, iterations: u32) -> QuantumRegister
Run Grover’s algorithm for iterations steps and return the register.
Trait Implementations§
Source§impl Clone for GroverOracle
impl Clone for GroverOracle
Source§fn clone(&self) -> GroverOracle
fn clone(&self) -> GroverOracle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GroverOracle
impl RefUnwindSafe for GroverOracle
impl Send for GroverOracle
impl Sync for GroverOracle
impl Unpin for GroverOracle
impl UnsafeUnpin for GroverOracle
impl UnwindSafe for GroverOracle
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