pub struct Grover { /* private fields */ }Expand description
Implementations§
Source§impl Grover
impl Grover
Sourcepub fn new(oracle: Oracle) -> Result<Self, AlgorithmError>
pub fn new(oracle: Oracle) -> Result<Self, AlgorithmError>
Create a new Grover search instance.
Sourcepub fn with_iterations(self, iterations: usize) -> Self
pub fn with_iterations(self, iterations: usize) -> Self
Set a specific number of iterations (overrides optimal calculation).
Sourcepub fn optimal_iterations(&self) -> usize
pub fn optimal_iterations(&self) -> usize
Calculate the optimal number of iterations.
Optimal iterations ≈ π/4 × √(N/M)
Sourcepub fn build_circuit(&self) -> Result<Circuit, AlgorithmError>
pub fn build_circuit(&self) -> Result<Circuit, AlgorithmError>
Build the Grover circuit.
Sourcepub fn run(&self, shots: u32) -> Result<GroverResult, AlgorithmError>
pub fn run(&self, shots: u32) -> Result<GroverResult, AlgorithmError>
Run Grover’s algorithm.
Auto Trait Implementations§
impl Freeze for Grover
impl RefUnwindSafe for Grover
impl Send for Grover
impl Sync for Grover
impl Unpin for Grover
impl UnwindSafe for Grover
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> 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