pub struct QVAE {
pub num_data_qubits: usize,
pub num_latent_qubits: usize,
pub num_ancilla_qubits: usize,
pub encoder_params: Vec<f64>,
pub decoder_params: Vec<f64>,
}Expand description
Quantum Variational Autoencoder
Fields§
§num_data_qubits: usizeNumber of data qubits
num_latent_qubits: usizeNumber of latent qubits (compressed representation)
num_ancilla_qubits: usizeNumber of ancilla qubits for encoding
encoder_params: Vec<f64>Encoder parameters
decoder_params: Vec<f64>Decoder parameters
Implementations§
Source§impl QVAE
impl QVAE
Sourcepub fn new(
num_data_qubits: usize,
num_latent_qubits: usize,
num_ancilla_qubits: usize,
) -> Result<Self, MLError>
pub fn new( num_data_qubits: usize, num_latent_qubits: usize, num_ancilla_qubits: usize, ) -> Result<Self, MLError>
Create a new quantum variational autoencoder
Sourcepub fn total_qubits(&self) -> usize
pub fn total_qubits(&self) -> usize
Get total number of qubits required
Sourcepub fn encode<const N: usize>(
&self,
circuit: &mut Circuit<N>,
data_start: usize,
latent_start: usize,
) -> Result<(), MLError>
pub fn encode<const N: usize>( &self, circuit: &mut Circuit<N>, data_start: usize, latent_start: usize, ) -> Result<(), MLError>
Apply encoding circuit
Sourcepub fn decode<const N: usize>(
&self,
circuit: &mut Circuit<N>,
latent_start: usize,
output_start: usize,
) -> Result<(), MLError>
pub fn decode<const N: usize>( &self, circuit: &mut Circuit<N>, latent_start: usize, output_start: usize, ) -> Result<(), MLError>
Apply decoding circuit
Sourcepub fn build_circuit<const N: usize>(&self) -> Result<Circuit<N>, MLError>
pub fn build_circuit<const N: usize>(&self) -> Result<Circuit<N>, MLError>
Build full autoencoder circuit
Sourcepub fn reconstruction_fidelity(
&self,
input_state: &[Complex],
output_state: &[Complex],
) -> Result<f64, MLError>
pub fn reconstruction_fidelity( &self, input_state: &[Complex], output_state: &[Complex], ) -> Result<f64, MLError>
Compute reconstruction fidelity
Sourcepub fn get_parameters(&self) -> Vec<f64>
pub fn get_parameters(&self) -> Vec<f64>
Get all trainable parameters
Auto Trait Implementations§
impl Freeze for QVAE
impl RefUnwindSafe for QVAE
impl Send for QVAE
impl Sync for QVAE
impl Unpin for QVAE
impl UnwindSafe for QVAE
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.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.