pub struct PhaseOracle<O, F, C> { /* private fields */ }Expand description
A phase oracle built from an Oracle and a map from basis index to candidate.
It changes the sign of each basis state whose candidate the oracle accepts. The map
returns None for an index without a candidate, for example when the candidate count is
not a power of two; such an index is never marked.
§Query count
One apply is one quantum query, and one check is one
classical query, as in the query model. The simulator calls Oracle::accepts once per
basis state inside one apply; that cost is a property of the simulation, not of the
algorithm, so it does not count.
Implementations§
Source§impl<O, F, C> PhaseOracle<O, F, C>
impl<O, F, C> PhaseOracle<O, F, C>
Sourcepub fn new(oracle: O, candidate: F) -> Self
pub fn new(oracle: O, candidate: F) -> Self
Makes a phase oracle from oracle and the index map candidate.
Sourcepub fn apply(&mut self, state: &mut StateVector)
pub fn apply(&mut self, state: &mut StateVector)
Changes the sign of every marked basis state of state. This counts as one query.
Trait Implementations§
Auto Trait Implementations§
impl<O, F, C> Forget for PhaseOracle<O, F, C>
impl<O, F, C> Freeze for PhaseOracle<O, F, C>
impl<O, F, C> Move for PhaseOracle<O, F, C>
impl<O, F, C> RefUnwindSafe for PhaseOracle<O, F, C>
impl<O, F, C> Send for PhaseOracle<O, F, C>
impl<O, F, C> Sync for PhaseOracle<O, F, C>
impl<O, F, C> Unpin for PhaseOracle<O, F, C>
impl<O, F, C> UnsafeUnpin for PhaseOracle<O, F, C>
impl<O, F, C> UnwindSafe for PhaseOracle<O, F, C>
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