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 more