pub struct QuantumAutoDiff { /* private fields */ }Expand description
Quantum automatic differentiation engine
Implementations§
Source§impl QuantumAutoDiff
impl QuantumAutoDiff
Sourcepub fn new(config: QuantumAutoDiffConfig) -> Self
pub fn new(config: QuantumAutoDiffConfig) -> Self
Create a new quantum automatic differentiation engine
Sourcepub fn register_parameter(
&mut self,
name: &str,
initial_value: f64,
bounds: Option<(f64, f64)>,
) -> QuantRS2Result<usize>
pub fn register_parameter( &mut self, name: &str, initial_value: f64, bounds: Option<(f64, f64)>, ) -> QuantRS2Result<usize>
Register a parameter for differentiation
Sourcepub fn compute_gradients<F>(
&mut self,
function: F,
parameter_ids: &[usize],
method: Option<DifferentiationMethod>,
) -> QuantRS2Result<GradientResult>
pub fn compute_gradients<F>( &mut self, function: F, parameter_ids: &[usize], method: Option<DifferentiationMethod>, ) -> QuantRS2Result<GradientResult>
Compute gradients using the specified method
Sourcepub fn compute_higher_order_derivatives<F>(
&mut self,
function: F,
parameter_ids: &[usize],
max_order: usize,
) -> QuantRS2Result<HigherOrderResult>
pub fn compute_higher_order_derivatives<F>( &mut self, function: F, parameter_ids: &[usize], max_order: usize, ) -> QuantRS2Result<HigherOrderResult>
Compute higher-order derivatives
Sourcepub fn circuit_gradients<F>(
&mut self,
circuit_function: F,
gate_parameters: &[(usize, String, Vec<usize>)],
observable: &str,
) -> QuantRS2Result<Vec<GradientResult>>
pub fn circuit_gradients<F>( &mut self, circuit_function: F, gate_parameters: &[(usize, String, Vec<usize>)], observable: &str, ) -> QuantRS2Result<Vec<GradientResult>>
Compute gradients with respect to quantum circuit parameters
Sourcepub fn parameter_update(
&mut self,
gradients: &GradientResult,
learning_rate: f64,
optimizer: OptimizerType,
) -> QuantRS2Result<()>
pub fn parameter_update( &mut self, gradients: &GradientResult, learning_rate: f64, optimizer: OptimizerType, ) -> QuantRS2Result<()>
Optimize parameter update using gradient information
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QuantumAutoDiff
impl RefUnwindSafe for QuantumAutoDiff
impl Send for QuantumAutoDiff
impl Sync for QuantumAutoDiff
impl Unpin for QuantumAutoDiff
impl UnwindSafe for QuantumAutoDiff
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.